Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
spirosu
 
Posts: n/a
Default if statements, searching for commma


Does anyone know if there is a way to use the if function to search for
comma's within a cell. For instance, in the below, using the if
function, I've tried the below without success.

if(A1=",","Flag","Unflag")

It's obviously wrong...I'd greatly appreciate if someone can lend me a
hand. Seems simple enough but can't figure it out.


_Column_A__
Row 1 EMERGING MARKETS
Row 2 KINNUNEN, JUHA
Row 3 POSEN, DAVID
Row 4 HORTON, WILLIAM


--
spirosu
------------------------------------------------------------------------
spirosu's Profile: http://www.excelforum.com/member.php...fo&userid=7442
View this thread: http://www.excelforum.com/showthread...hreadid=513762

  #2   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK
 
Posts: n/a
Default if statements, searching for commma

Use the FIND( ) function, as follows:

=IF(FIND(",",A1),"Flag","Unflag")

Hope this helps.

Pete

  #3   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default if statements, searching for commma


You can use the following IF, which uses the find function to look for your
comma. The find function returns an integer value indicating what character
position the character you're looking for was found in, if it is not found
find returns a zero (0).

=IF(FIND(",",A1,1)0,"Flag","Unflag")
--
Kevin Backmann


"spirosu" wrote:


Does anyone know if there is a way to use the if function to search for
comma's within a cell. For instance, in the below, using the if
function, I've tried the below without success.

if(A1=",","Flag","Unflag")

It's obviously wrong...I'd greatly appreciate if someone can lend me a
hand. Seems simple enough but can't figure it out.


_Column_A__
Row 1 EMERGING MARKETS
Row 2 KINNUNEN, JUHA
Row 3 POSEN, DAVID
Row 4 HORTON, WILLIAM


--
spirosu
------------------------------------------------------------------------
spirosu's Profile: http://www.excelforum.com/member.php...fo&userid=7442
View this thread: http://www.excelforum.com/showthread...hreadid=513762


  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default if statements, searching for commma

=if(isnumber(search(",",a1)),"flag","unflag")

or

=if(countif(a1,"*,*")0,"flag","unflag")

spirosu wrote:

Does anyone know if there is a way to use the if function to search for
comma's within a cell. For instance, in the below, using the if
function, I've tried the below without success.

if(A1=",","Flag","Unflag")

It's obviously wrong...I'd greatly appreciate if someone can lend me a
hand. Seems simple enough but can't figure it out.

_Column_A__
Row 1 EMERGING MARKETS
Row 2 KINNUNEN, JUHA
Row 3 POSEN, DAVID
Row 4 HORTON, WILLIAM

--
spirosu
------------------------------------------------------------------------
spirosu's Profile: http://www.excelforum.com/member.php...fo&userid=7442
View this thread: http://www.excelforum.com/showthread...hreadid=513762


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
spirosu
 
Posts: n/a
Default if statements, searching for commma


Thanks for the ultra fast response everyone! Working like a charm now.

Spiro


--
spirosu
------------------------------------------------------------------------
spirosu's Profile: http://www.excelforum.com/member.php...fo&userid=7442
View this thread: http://www.excelforum.com/showthread...hreadid=513762



  #6   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default if statements, searching for commma


Is it your aim just to establish whether the cell contains a comma, or
do you want to do something with that information?

Perhaps there's a better way to achieve your ultimate objective.

btw, as you may have noticed

=FIND(",",A1) will give a #VALUE! error if A1 doesn't contain a comma

my suggestion, which returns TRUE (if there is a comma) or FALSE if
not

=FIND(",",A1&",")<=LEN(A1)


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=513762

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
UDFunctions and nested If-the-else statements JDB Excel Worksheet Functions 1 January 25th 06 03:29 PM
How do I sum percentages calculated from IF statements? Rusty T Excel Worksheet Functions 3 November 9th 05 10:02 PM
Linking two IF statements together trixma Excel Discussion (Misc queries) 2 September 29th 05 06:07 AM
Logical ELSE statements Ruth Excel Discussion (Misc queries) 2 June 23rd 05 03:23 PM
Nested IF statements John Simons Excel Worksheet Functions 14 February 16th 05 06:17 AM


All times are GMT +1. The time now is 02:57 PM.

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

About Us

"It's about Microsoft Excel"