IF and FIND

Revengerer

New Member
Joined
Jun 28, 2007
Messages
6
Hi People,

2 parts to my problem

Part 1 - i'm trying to write a formula using the IF and FIND command.
=IF(FIND("Successful",C2,1),"Successful","0")
if C2 contains the word "Successful" then the command works.
if it doesn't it returns a #VALUE!, even if i enter a [value_if_false] ("0")
Possible entries for C2 would be: Successful, Incomplete, Cancelled, Failed

Part 2 - what i would really like is
=IF(FIND("Successful",C2,1),"Successful",(FIND("Failed",C2,1))

i know that i'm doing something wrong i just don't know what. also i wouldl ike to be able to have this as a formula rather than a VBS ect

thanks in advance
Gavin
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try this:
Code:
=IF(OR(C2="Successful",C2="Incomplete",C2="Cancelled,",C2="Failed",),"Successful","not found")
 
Upvote 0
thanks for the quick response.

C2 does not only have the word successful which is why i was trying to use the FIND command. below are examples of the full data of C2

SWMSP01: [JobID:621 ] Backup Operation Successful.
SWNWC01: [JobID:1389 ] Backup Operation Failed.
"SWNWP01: [JobID:309 ] Backup Operation Incomplete. Number of Error(s)/Warning(s): 0/2

hope this isn't too confusing
 
Upvote 0
Try this long formula:
Code:
=IF(ISNUMBER(FIND("Successful",C2,1)),"Successful",IF(ISNUMBER(FIND("Incomplete",C2,1)),"Incomplete",IF(ISNUMBER(FIND("Cancelled",C2,1)),"Cancelled",IF(ISNUMBER(FIND("Failed",C2,1)),"Failed","None"))))
It inputs "None" if all tests fail.
 
Upvote 0
Thanks heaps John,

i was trying to work on a similar formula but this has nailed it on the head.

thanks for all your help
 
Upvote 0
This is a little longer but may in fact be easier to edit and add more words.

Assumes data starts in C1.

Code:
=IF(ISNA(MATCH(1,IF(FIND({"Successful","Failed","Incomplete","Cancelled",None},C1),ROW($A$1:$A$5)))),"None",CHOOSE(MATCH(1,IF(FIND({"Successful","Failed","Incomplete","Cancelled","None"},C1),ROW($A$1:$A$5))),"Successful","Failed","Incomplete","Cancelled","None"))

As well FIND is case sensitive. If this could cause issues, then:

Code:
=IF(ISNA(MATCH(1,IF(FIND({"successful","failed","incomplete","cancelled","none"},LOWER(C1)),ROW($A$1:$A$5)))),"Failed",CHOOSE(MATCH(1,IF(FIND({"successful","failed","incomplete","cancelled","none"},LOWER(C1)),ROW($A$1:$A$5))),"Successful","Failed","Incomplete","Cancelled","None"))

HTH!
 
Upvote 0

Forum statistics

Threads
1,222,441
Messages
6,166,047
Members
452,009
Latest member
oishi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top