how to combine if statement syntax for Search function with 2 possible values: "N" or "S"

Joined
Aug 7, 2018
Messages
2
I currently have the following Excel If statements:


=IF(ISNUMBER(SEARCH("N",C37)),'Plan Code info '!C2,"")

=IF(ISNUMBER(SEARCH("S",C37)),'Plan Code info '!C3,"")

What is the correct syntax to combine these into one statement so that I can have logic to handle if there are values of "N" or "S" in the same cell?

I am using a reference to another sheet to populate the cell with specific values based on "S" or "N"

Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Welcome to the Board!

Can both "N" and "S" appear in the same cell?
If so, what do you want to happen in that case?

If only one of those two values can appear in the cell, and you just want one formula to handle either case, try nesting the IF statements, i.e.
Code:
[COLOR=#333333]=IF(ISNUMBER(SEARCH("N",C37)),'Plan Code info '!C2,[/COLOR][COLOR=#333333]IF(ISNUMBER(SEARCH("S",C37)),'Plan Code info '!C3,"")[/COLOR][COLOR=#333333])[/COLOR]
 
Upvote 0
You are welcome.
Glad I was able to help!:)
 
Upvote 0

Forum statistics

Threads
1,216,172
Messages
6,129,291
Members
449,498
Latest member
Lee_ray

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