Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 170
Default test text string for a comma (,)

Excel XP on WinXP

Inherited a spreadsheet from another user. Have a mixture of lname, fname
and fname lname combinations. I can successfully convert the lname, fname to
fname lname, teh problem is those cells that are already in the fname lname
return a #Value error.

I thought I could find a way to logically test the string for a comma(,) and
use an If statement to control my concatenate formula. I can't find a way to
test logically for the comma.

Can anyone offer a solution?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 170
Default test text string for a comma (,)

Thanks for allowing me to post the problem. Finished teh post and searched
one more time, came up with teh ISERR and applied that. Worked great! here is
what I finally used
=IF(ISERR(RIGHT(A61,(LEN(A61)-FIND(",",A61)-1))&"
"&LEFT(A61,FIND(",",A61)-1)),A61,RIGHT(A61,(LEN(A61)-FIND(",",A61)-1))&"
"&LEFT(A61,FIND(",",A61)-1))

Where Col A contained a combination of "fname lname" and "lname, fname"
entries.
Maybe this will help someone else down the road!
"JR Hester" wrote:

Excel XP on WinXP

Inherited a spreadsheet from another user. Have a mixture of lname, fname
and fname lname combinations. I can successfully convert the lname, fname to
fname lname, teh problem is those cells that are already in the fname lname
return a #Value error.

I thought I could find a way to logically test the string for a comma(,) and
use an If statement to control my concatenate formula. I can't find a way to
test logically for the comma.

Can anyone offer a solution?

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default test text string for a comma (,)

=if(isnumber(search(a1&" ",",")),"has comma", "no comma")
(a1&" " will avoid "has comma" when A1 is empty)

=if(countif(a1,"*,*")0,"has comma","no comma")
is another way.

=len(a1)-len(substitute(a1,",",""))
will return the number of commas in A1


JR Hester wrote:

Excel XP on WinXP

Inherited a spreadsheet from another user. Have a mixture of lname, fname
and fname lname combinations. I can successfully convert the lname, fname to
fname lname, teh problem is those cells that are already in the fname lname
return a #Value error.

I thought I could find a way to logically test the string for a comma(,) and
use an If statement to control my concatenate formula. I can't find a way to
test logically for the comma.

Can anyone offer a solution?

Thank you


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default test text string for a comma (,)

Try this:

=IF(COUNT(FIND(",",A1)),MID(A1&" "&A1,FIND(",",A1)+2,LEN(A1)-1),A1)

Lname, Fname will be reversed to Fname Lname

Fname Lname will not change

I didn't test this on names with middle intials or with multiple first and
last names:

Billy Bob B. Jones Jr
De La Hoya, Oscar Jr

If you have names like that....good luck!

--
Biff
Microsoft Excel MVP


"JR Hester" wrote in message
...
Thanks for allowing me to post the problem. Finished teh post and searched
one more time, came up with teh ISERR and applied that. Worked great! here
is
what I finally used
=IF(ISERR(RIGHT(A61,(LEN(A61)-FIND(",",A61)-1))&"
"&LEFT(A61,FIND(",",A61)-1)),A61,RIGHT(A61,(LEN(A61)-FIND(",",A61)-1))&"
"&LEFT(A61,FIND(",",A61)-1))

Where Col A contained a combination of "fname lname" and "lname, fname"
entries.
Maybe this will help someone else down the road!
"JR Hester" wrote:

Excel XP on WinXP

Inherited a spreadsheet from another user. Have a mixture of lname,
fname
and fname lname combinations. I can successfully convert the lname, fname
to
fname lname, teh problem is those cells that are already in the fname
lname
return a #Value error.

I thought I could find a way to logically test the string for a comma(,)
and
use an If statement to control my concatenate formula. I can't find a way
to
test logically for the comma.

Can anyone offer a solution?

Thank you



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
Extract the text between last comma and last but one comma. Sreedevi Excel Worksheet Functions 2 March 5th 08 11:12 PM
Need to test for a specific text string and write value to another Pyramid 36 Excel Worksheet Functions 2 August 3rd 07 12:55 AM
Test String LucB Excel Discussion (Misc queries) 2 November 29th 06 02:49 AM
how do i concatenate a string and cell formula and use a comma? bob alou Excel Worksheet Functions 2 February 24th 06 03:30 PM
need to remove a comma from end of test in cells Jerry Kinder Excel Worksheet Functions 4 December 14th 05 01:25 AM


All times are GMT +1. The time now is 04:52 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"