Indirect Vlookup with IF statements

thewiseguy

Well-known Member
Joined
May 23, 2005
Messages
954
Office Version
  1. 365
Platform
  1. Windows
Hi all. Having trouble combining functions.

Here is my formula which needs some work:

=IFERROR(VLOOKUP(B2,INDIRECT(VLOOKUP(C2,TableNames,2)),8,0),"")

instead of returning the value in the 8th column, I want to add these IF conditions:

=IF(E2≤20,17)
=IF(E2 is between 21-50, 18)
=IF(E2 is between 51-100, 19)
=IF(E2 ≥ 100,20)

is this possible?

many thanks in advance.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Replace the 8 with
16+MATCH(E2,{0,21,51,101},1)
 
Upvote 0
Replace the 8 with
16+MATCH(E2,{0,21,51,101},1)

sorry, I completely gave the wrong information. In my above example where you see, 17,18,19,20 - these represent the column numbers to lookup in the vlookup
 
Upvote 0
In that case please post some sample data using the XL2BB add-in, showing expected results & why.
Also please update you account details, to show what version of Excel you are using.
 
Upvote 0
This my BOM tab (bill of materials). It will have any number of items in the "B" column.

Proposal5.xlsm
ABCDEF
1ManufacturerItemFixtureCategoryProduct IDQtyCost
2T-1T-1 Lighting 135W LED Linear High Bay w/ Occ. Sensor 5KHighBayLinearT1-G2HBLED/U/135-50-OS108
Sheet1


I am trying to get the cost of the item in column B, based on the qty (Column E) - (prices goes down as qty goes up).

On multiple separate tabs, I have tables. My indirect with vlookup formula that I mentioned above, is the formula I am trying to use.

The value in this example that should be returned would be $104

Proposal5.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
1EMA DESCRIPTIONDESCRIPTIONECM CategoryECM Spec.ReplacesECM SizeMFGPART NO.ECM LumensNO. LAMPSLAMP WATTSNO. FIXTURESFIXTURE WATTSSYSTEM WATTSECM LIFEECM TEMPLamp Cost1-20PC21-50PC51-100PC101-200PCTOTAL ECM COSTLABORECM UNIT INCENTIVEMEASURE CODENJSS Proposed Fix TypeNJSS Fix/Lamp Desc.N/RNotes
2T-1 Lighting 321W LED Linear High Bay 4K321W LED Linear High Bay 4KHighBayLinear2FTT-1 LightingT1-HBLED/B/321-401321321500004000$259.00$234.00$227.00$220.0030150PL11LED - DLC FixtureLED High-Bay and Low-Bay Fixtures >250W N
3T-1 Lighting 321W LED Linear High Bay 5K321W LED Linear High Bay 5KHighBayLinear2FTT-1 LightingT1-HBLED/B/321-501321321500005000$259.00$234.00$227.00$220.0030150PL11LED - DLC FixtureLED High-Bay and Low-Bay Fixtures >250W N
4T-1 Lighting 135W LED Linear High Bay w/ Occ. Sensor 4K135W LED Linear High Bay w/ Occ. Sensor 4KHighBayLinear2FTT-1 LightingT1-G2HBLED/U/135-40-OS1135135500004000$111.00$109.00$106.00$104.003075PL10LED - DLC FixtureLED High-Bay and Low-Bay Fixtures >125W to ≤250W N
5T-1 Lighting 135W LED Linear High Bay w/ Occ. Sensor 5K135W LED Linear High Bay w/ Occ. Sensor 5KHighBayLinear2FTT-1 LightingT1-G2HBLED/U/135-50-OS1135135500005000$111.00$109.00$106.00$104.003075PL10LED - DLC FixtureLED High-Bay and Low-Bay Fixtures >125W to ≤250W N
Sheet4
 
Upvote 0
Assuming that you are looking up the value in col B of sheet4, then just replace the 8 in your formula with the formula I supplied.
 
Upvote 0
Assuming that you are looking up the value in col B of sheet4, then just replace the 8 in your formula with the formula I supplied.

so it looks like the formula is not accounting for quantities from 1-20.

also, the formula works for quantities from 21-200, however it is returning the value from the column left of where it should be.
 
Upvote 0
If E2 <21 it will pull data from the 17 column of the lookup range, which is what you said you wanted.
 
Upvote 0
so it looks like the formula is not accounting for quantities from 1-20.

also, the formula works for quantities from 21-200, however it is returning the value from the column left of where it should be.


*edit - i changed the 16 to 17 and it is now working.

i can't thank you enough - that is extremely helpful and impressive.

thank you!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,208
Members
448,951
Latest member
jennlynn

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