MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Brainteaser


Posted by Mark W. on January 08, 2001 1:50 PM

Write a formula using only built-in Excel functions
that returns a boolean value that indicating if a word
contained in a cell is spelled the same forwards and
backwards. For example, "solos" or "deed" would
return TRUE while "lotto" would return FALSE. Your
solution should work with words of any length.


Posted by Aladin Akyurek on January 08, 2001 3:19 PM

I thought there were lots of brainteasers around here...

Array-enter in the cell next to A1 where the first word to test is in

B1=MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)=MID(A1,LEN(A1)+1-ROW(INDIRECT("1:"&LEN(A1))),1)

Hope it works.

Aladin

Posted by Mark W. on January 08, 2001 3:30 PM

It most certainly does!

Posted by Mark W. on January 08, 2001 5:00 PM

Ah! Steve (see above) is right! Your solution
returns TRUE for "solas". I guess I goofed when I
pasted your formula into my test case. I thought
you had found a simplier solution that the one
I dreamed up. Care to try again?

Posted by Mark W. on January 08, 2001 5:20 PM

Ah! On further inspection you did find a simplier
solution than mine -- you just failed to pass it
to the AND() function as shown below.

{=AND(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)=MID(A1,LEN(A1)+1-ROW(INDIRECT("1:"&LEN(A1))),1))}


Posted by Aladin Akyurek on January 08, 2001 7:31 PM

That's right. The expression must me ANDed. Never Cut and Paste too fast -- not too often anyway.

Aladin