A little help with nested if

ShayAA

New Member
Joined
Apr 13, 2017
Messages
6
Hi,

Can someone please help me to create a nested if?

Basically, I want to check if a cell contains a string, and if not, check if it contains another string and so on.

My cell is A2.

If A2 contains the word "bracelet", A10 = "bracelet"
If A2 contains the word "necklace", A10 = "necklace"
If A2 contains the word "anklet", A10 = "anklet"
If A2 contains the word "earring", A10 = "earring"

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Code:
=IF(A2="bracelet","bracelet",IF(A2="necklace","necklace",IF(A2="anklet","anklet",IF(A2="earring","earring","Not defined, check!!"))))

Enter the formula into A10.
You might want to change the "Not defined, check!!" bit to something more approriate..
 
Upvote 0
Thanks, but I don't want to check if it equals to "bracelet" but contains the words bracelet, since it could be "red 10in bracelet - large" as an example.
 
Upvote 0
Try this
Code:
=IF(ISNUMBER(SEARCH("bracelet",A2)),"bracelet",IF(ISNUMBER(SEARCH("necklace",A2)),"necklace",IF(ISNUMBER(SEARCH("anklet",A2)),"anklet",IF(ISNUMBER(SEARCH("earring",A2)),"earring","Not defined, check!!"))))

Not very elegant.. but should do the job
 
Last edited:
Upvote 0
Try...
=IF(ISNUMBER(FIND("bracelet",A2,1)),"bracelet", IF(ISNUMBER(FIND("necklace",A2,1)),"necklace",IF(ISNUMBER(FIND("anklet",A2,1)),"anklet",IF(ISNUMBER(FIND("earing",A2,1)),"earing","No Match"))))

Cross posted over Rory -Ditto
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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