Need help nesting a VLookup inside an index, I think?

texaschai

New Member
Joined
Feb 4, 2014
Messages
34
Hello all,
I've got a problem with a table I set up.

Here is the reference table:
2019-202018-192017-182016-172015-162014-152013-142012-132011-122010-112009-102008-09
Division #Div NameDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OH
4050400000Dev Svcs
20.31​
19.5718.4219.4123.4521.9520.1521.3521.3519.9119.9114.82
4050600000Design
14.88​
17.8118.4417.8322.0522.9018.5014.7518.8821.2515.7112.74
4050700000Enviro
17.01​
16.7616.0316.7114.9011.709.259.0010.269.779.779.77
4050800000Const
12.47​
13.3111.0712.4515.1015.4011.857.7510.007.337.337.33
4050900000Roads
0.63​
0.520.670.950.550.450.400.480.480.430.430.43
4051000000Util
6.88​
6.886.457.638.907.255.205.005.004.384.384.38
4051100000Water Qual
10.52​
8.038.1911.3515.4014.7511.8511.7111.7111.7111.7115.80
4051200000Transpo
19.51​
14.209.5611.629.007.805.757.509.2910.867.231.25
4051300000Water Res
9.51​
13.3514.8712.008.90N/AN/AN/AN/AN/AN/AN/A
4051400000Fac Plan
9.36​
10.3120.0010.00N/AN/AN/AN/AN/AN/AN/AN/A

And on another tab, I have this information in multiple tables for quarters of the year (I have 4 tables for each FY):
2019-20Quarter 2
AmountPartner ObjectDivision & EmployeeHoursPhDivision
OH Rate
Total OH
134.00​
4051200000/D39410PW Transportation / GD REGULAR
1.00​
.0419.5119.51
171.36​
4051200000/D39415PW Transportation / GD TELECM REG
1.25​
.0419.5124.39
1,269.26​
4051200000/M01610PW Transportation / CM REGULAR
10.75​
.0419.51209.73
4,635.43​
4051200000/M01615PW Transportation / CM TELECM REG
39.00​
.0419.51760.89
4,982.78​
4050700000/S22010PW Environmental / TL REGULAR58.00.0217.01986.58

As you can see, in column B of the 2nd table, it includes a text string that contains both the Division # (as it shows in the first table), a "/", and then the employee number. What I need to do is to look up the division OH rate based on the Division # in the text string. I currently have a VLOOKUP using a LEFT formula in the Division OH Rate column in the second table, but now I need to add a column to the left of column C in the first table so I can enter the new year for the new year's quarters and it throws off every year because it's doing a VLOOKUP to the 3rd row or 4th row instead of doing a lookup by the actual year (I don't want to have to update each prior quarter's "col reference" each time I add a new year, in other words.

What I want to do is, in the 2nd table, column F (Division OH Rate) to look up the YEAR I listed in bold in cell A1 of the second table, plus look up the left side of the text string in column B of the second table, and reference the columns by year and division # in the first table to get the Division OH Rate. I know it probably will take an INDEX but I'm not sure how to do an INDEX with a "LEFT" nested into it. Any help is appreciated because I need to fix about 30 spreadsheets (one for each project) and add in the new year. I don't want to have to update each quarter going forward every time I add a year.

Hope that makes sense!
Thanks,
Charlotte
 
You need to add 2 to the number returned by the match. This is because your lookup columns start at col a but your match columns start at c
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You need to add 2 to the number returned by the match. This is because your lookup columns start at col a but your match columns start at c
Do you mean like this?
=VLOOKUP(LEFT(B3,10),'Div OH'!$A$2:$N$11,MATCH(A1,'Div OH'!C1:N1),2)
If so, that still results in #N/A.
Interestingly, if I type "=VLOOKUP(LEFT(AQ5,10)*1,'Div OH'!A2:N12,MATCH(AP$2,'Div OH'!C2:N2,0))" or "=VLOOKUP(LEFT(AQ5,10)*1,'Div OH'!A2:N12,MATCH(AP$2,'Div OH'!C2:N2,2))", it returns a number, but it's the wrong number in the match chart for the years' division OH rates... It weirdly returns 2010-11 instead of the 2019-20. So weird.
 
Upvote 0
No , when i said add 2 I meant add 2 i.e.:
VBA Code:
=VLOOKUP(LEFT(AQ5,10)*1,'Div OH'!A2:N12,MATCH(AP$2,'Div OH'!C2:N2,0)+2)
 
Upvote 0
No , when i said add 2 I meant add 2 i.e.:
VBA Code:
=VLOOKUP(LEFT(AQ5,10)*1,'Div OH'!A2:N12,MATCH(AP$2,'Div OH'!C2:N2,0)+2)
Thank you for continuing to assist. That formula also did not work, and in fact when I add a plus two "+2" at the end, once I hit enter, it changes it to a space and a two (no plus) and still gives me an N/A. I tried it both with the =VLOOKUP(LEFT(AQ5,10)*1,'Div OH'!A2:N12,MATCH(AP$2,'Div OH'!C2:N2,0)+2) which gives me just the result as if I just said "LEFT(AQ5,10)" and without the *1, which didn't work. :(
Let me know if you want more screenshots.
 
Upvote 0
With your data like
+Fluff New.xlsm
ABCDEFGHIJKLMN
12019-202018-192017-182016-172015-162014-152013-142012-132011-122010-112009-102008-09
2Division #Div NameDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OHDivision OH
34050400000Dev Svcs20.3119.5718.4219.4123.4521.9520.1521.3521.3519.9119.9114.82
44050600000Design14.8817.8118.4417.8322.0522.918.514.7518.8821.2515.7112.74
54050700000Enviro17.0116.7616.0316.7114.911.79.25910.269.779.779.77
64050800000Const12.4713.3111.0712.4515.115.411.857.75107.337.337.33
74050900000Roads0.630.520.670.950.550.450.40.480.480.430.430.43
84051000000Util6.886.886.457.638.97.255.2554.384.384.38
94051100000Water Qual10.528.038.1911.3515.414.7511.8511.7111.7111.7111.7115.8
104051200000Transpo19.5114.29.5611.6297.85.757.59.2910.867.231.25
114051300000Water Res9.5113.3514.87128.9N/AN/AN/AN/AN/AN/AN/A
124051400000Fac Plan9.3610.312010N/AN/AN/AN/AN/AN/AN/AN/A
13
Div OH


Try either of these
+Fluff New.xlsm
ABCDEFGH
12019-20Quarter 2
2AmountPartner ObjectDivision & EmployeeHoursPhDivision OH RateTotal OH
31344051200000/D39410PW Transportation / GD REGULAR10.0419.5119.5119.51
4171.364051200000/D39415PW Transportation / GD TELECM REG1.250.0419.5124.3919.51
51,269.264051200000/M01610PW Transportation / CM REGULAR10.750.0419.51209.7319.51
64,635.434051200000/M01615PW Transportation / CM TELECM REG390.0419.51760.8919.51
74,982.784050700000/S22010PW Environmental / TL REGULAR580.0217.01986.5817.01
8
Sheet1
Cell Formulas
RangeFormula
F3:F7F3=INDEX('Div OH'!$C$3:$N$12,MATCH(LEFT(B3,10)*1,'Div OH'!$A$3:$A$12,0),MATCH($A$1,'Div OH'!$C$1:$N$1,0))
H3:H7H3=VLOOKUP(LEFT(B3,10)*1,'Div OH'!$A$2:$N$12,MATCH($A$1,'Div OH'!$C$1:$N$1,0)+2)
 
Upvote 0
Solution
FLUFF FOR THE WIN!!
Thank you SOOOO much. :) That worked... both of them. I didn't understand the H column ranges but when I put either in the same cell (F3), it worked. Weirdly, that second formula looks the same as the formula we tried earlier. But when I copied and pasted from your sheet, it worked. Thank you again. You're a life saver.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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