Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
yan
 
Posts: n/a
Default how do i find palindromes using excel?

how do i find palindromes using excel?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default how do i find palindromes using excel?

Find where? Are you asking if you can test if a string is a palindrome?
Or do you want to reverse a number, if the latter with the number in A1 use

=SUMPRODUCT(--(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))*10^(ROW(IN DIRECT("1:"&
LEN(A1)))-1))

--

Regards,

Peo Sjoblom


"yan" wrote in message
...
how do i find palindromes using excel?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
B. R.Ramachandran
 
Posts: n/a
Default how do i find palindromes using excel?

Hi,

This is an absolutely inelegant solution to your post, but see whether it
works for you (Excel experts would laugh at this formula)!

To check whether a given string (upto 16 characters) contained in cell A1 is
a palindrome use the following formula:

=A1=MID(A1,16,1)&MID(A1,15,1)&MID(A1,14,1)&MID(A1, 13,1)&MID(A1,12,1)&MID(A1,11,1)&MID(A1,10,1)&MID(A 1,9,1)&MID(A1,8,1)&MID(A1,7,1)&MID(A1,6,1)&MID(A1, 5,1)&MID(A1,4,1)&MID(A1,3,1)&MID(A1,2,1)&MID(A1,1, 1)

If the string is a palindrome the formula returns "TRUE", else "FALSE".
Note that the formula doesn't differentiate upper and lower cases. If the
string is a number, start with a ' character.

To reverse a string (upto 16 characters),
remove the "=A1" at the beginning of the formula.

Regards,
B. R. Ramachandran

"yan" wrote:

how do i find palindromes using excel?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Duke Carey
 
Posts: n/a
Default how do i find palindromes using excel?

Using VBA

Function Palindrome(strTest As String) As Boolean
Palindrome = Trim(strTest) = StrReverse(Trim(strTest))
End Function

See Chip Pearson's site for guidance on where to place the function's code
http://www.cpearson.com/excel/codemods.htm

Once you've got the code in the right place, utilize it like so:

with the word or phrase you want test in A1, put

=Palindrome(A1)

in B1. If it's a palindrome you'll see TRUE, otherwise FALSE


"yan" wrote:

how do i find palindromes using excel?

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default how do i find palindromes using excel?

On Fri, 13 Jan 2006 07:50:02 -0800, yan wrote:

how do i find palindromes using excel?


Here's one way:

Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr

With your test string in A1, the following formula will show TRUE if it is a
palindrome, and FALSE if it is not.

I assumed that you did NOT want to include punctuation, so that a string like:

"Madam, I'm Adam"

would test as true.

=REGEX.SUBSTITUTE(A1,"\W")=TEXTREVERSE(REGEX.SUBST ITUTE(A1,"\W"))

This will also work with numeric input. However, if the number being tested
has one or more leading zeros, it will have to be entered as TEXT.


--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default how do i find palindromes using excel?

On Fri, 13 Jan 2006 11:14:03 -0800, "Duke Carey"
wrote:

Using VBA

Function Palindrome(strTest As String) As Boolean
Palindrome = Trim(strTest) = StrReverse(Trim(strTest))
End Function

See Chip Pearson's site for guidance on where to place the function's code
http://www.cpearson.com/excel/codemods.htm

Once you've got the code in the right place, utilize it like so:

with the word or phrase you want test in A1, put

=Palindrome(A1)

in B1. If it's a palindrome you'll see TRUE, otherwise FALSE


"yan" wrote:

how do i find palindromes using excel?



It might be preferable to ignore punctuation and case as well as spaces.

Perhaps:

===================================
Function Palindrome(StrTest As String) As Boolean
Dim temp As String
Dim i As Long

For i = 1 To Len(StrTest)
If Mid(StrTest, i, 1) Like "[0-9A-Za-z]" Then
temp = temp & UCase(Mid(StrTest, i, 1))
End If
Next i

Palindrome = temp = StrReverse(temp)

End Function
==========================


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unhide menu bar in excel - just disappeared Sean Setting up and Configuration of Excel 12 April 4th 23 10:19 AM
How do I find items common to two columns in Excel? TJ auminer Excel Discussion (Misc queries) 0 November 18th 05 04:20 PM
How do I find items common to two columns in Excel? bpeltzer Excel Discussion (Misc queries) 0 November 18th 05 04:11 PM
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? nwtrader8 Excel Discussion (Misc queries) 5 June 21st 05 02:16 PM
Linking Excel files -- I cannot find an answer anywhere. MAB Excel Discussion (Misc queries) 0 March 28th 05 06:47 PM


All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"