Iferror + if + or + vlookup

Nanogirl21

Active Member
Joined
Nov 19, 2013
Messages
331
Office Version
  1. 365
Platform
  1. Windows
I am trying to combine 4 excel formulas. Can someone please help. Thank you.

On sheet called Tracking in Cell AF2 I’d like to create a formula with these rules…

(STEP 1) IF X2 contains the word Apple OR Oranges return VLOOKUP(B:B,Math!B:Z,18,FALSE).
(STEP 2) IF STEP 1 returns value of 0, (blank), -, or #N/A error return value located in AA2.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Step 1 (formula in cell AF2):
Code:
=IF(OR(ISNUMBER(SEARCH("Apple",X2)),ISNUMBER(SEARCH("Oranges",X2))),VLOOKUP(B:B,Math!B:Z,18,FALSE),"")

Step 2:
Code:
=IF(ISNA(AF2),AA2,IF(OR(AF2=0,AF2="",AF2="-"),AA2,""))
 
Upvote 0
Step 1 (formula in cell AF2):
Code:
=IF(OR(ISNUMBER(SEARCH("Apple",X2)),ISNUMBER(SEARCH("Oranges",X2))),VLOOKUP(B:B,Math!B:Z,18,FALSE),"")

Step 2:
Code:
=IF(ISNA(AF2),AA2,IF(OR(AF2=0,AF2="",AF2="-"),AA2,""))


Thank you. Is there any way to combine these and have 1 long formula? I'd prefer not to use another column for STEP 2.
 
Upvote 0
I don't think that is a good idea. If it were me and I were tasked to do it as one single formula, I would go the VBA route and create my own User Defined Function to do it.

The concept behind combining this too is not hard. You can try it, if yo like. Simply substitute every reference of AF2 in the second formula with the first formula. You can see how unwieldy that can get in a hurry (as you will be doing 4 substitutions). It may really make performance lag. And personally, I would cringe at any formula that has 4 VLOOKUPS in it.

Another option. Why not just simply hide the column with the Step1 formula in it?
It does not need to be visible for the second formula to reference it.
 
Upvote 0
I don't think that is a good idea. If it were me and I were tasked to do it as one single formula, I would go the VBA route and create my own User Defined Function to do it.

The concept behind combining this too is not hard. You can try it, if yo like. Simply substitute every reference of AF2 in the second formula with the first formula. You can see how unwieldy that can get in a hurry (as you will be doing 4 substitutions). It may really make performance lag. And personally, I would cringe at any formula that has 4 VLOOKUPS in it.

Another option. Why not just simply hide the column with the Step1 formula in it?
It does not need to be visible for the second formula to reference it.

How would you create a user defined function? Sorry, i'm not too advanced with excel.

Thank you.
 
Upvote 0

Forum statistics

Threads
1,216,067
Messages
6,128,590
Members
449,460
Latest member
jgharbawi

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