# Nested IF function within an IF/lookup Function

#### brentcook

##### Board Regular
I need to look for a text value in a list. If it is true then equal a value. If false, look in a different list. If true, return a different value. If false, then return a third value. Is this possible?

Example:

 Apple Asparagus T-Bone Meat Orange Brussel Sprouts Grape Spinach Banana Broccoli

<tbody>
</tbody>

Explanation:

Unsuccessful Search of Column 1 for Cell D1 leads to unsuccsesful search of column 2 = MEAT.

If found in column 1, then Fruit

If found in column 2, then Vegetable

Any ideas?

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### yky

##### Well-known Member
Try this:

Code:
``=IF(ISNA(VLOOKUP(D1,A1:A4,1,FALSE)),IF(ISNA(VLOOKUP(D1,B1:B4,1,FALSE)),"not found","Vegetable"),"Fruit")``

#### brentcook

##### Board Regular
It worked perfectly. Thank you. I spent so long on this and I would never have thought of ISNA( .

One last thing, if the Lookup value had blanks mixed in, would I be able to leave the return value blanks as well?

#### brentcook

##### Board Regular
I should have tried to use my brain instead of going back to your fountain of knowledge. Ignore my last post. I can't thank you enough YKY. I was grasping at straws with this one. It works perfectly. You are a life saver.

Thanks,

Brent

Replies
6
Views
784
Replies
5
Views
402
Replies
5
Views
733
Replies
4
Views
459
Replies
2
Views
417

1,191,577
Messages
5,987,399
Members
440,096
Latest member
yanaungmyint

### 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.

### Which adblocker are you using?

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

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