If Statement - If false, then check next cell

jamber17

New Member
Joined
Jan 22, 2018
Messages
6
I'm creating a function that needs to find if a name in one cell (E3) matches a name in a list of cells. I have two formulas I've tried to use but neither is quite right.

Formula 1 could work, but it'll take forever to write all of the nested if statements (and it would be difficult to add new names to the list because you'd have to keep adding numbers and nested if statements. Is there a way to say that if E3 can't be found in A2, then it automatically checks the next cell (A3) and so on?

1. =IF(E$3=A2,A2,IF(E$3=A3,A3,IF(E$3=A4,A4)))...

Formula 2 could work, but I can't figure out how it would populate the correct cell if the statement was true (hence why it's bolded for now).

2. =IF(E$3=A2:A200,A2:A200,"ERROR")

If you have any other suggestions as well, I'd be more than happy to listen to them! Thanks!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
So basically, it looks like you just want to check to see if the value in E3 appears in the list A2:A200, and if it is, just return itself?
One way is like this:
Code:
=IF(COUNTIF($A$2:$A$200,E$3)>0,E$3,"ERROR")
This basically counts the number of times E3 is found in A2:A200. If that count is greater than 0 (meaning it has been found), return the value, else return "ERROR".
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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