VLOOKUP, XLOOKUP or INDEX?

mrstivoaddict

New Member
Joined
Aug 19, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I am currently using VLOOKUP to return a value from one tab to another.

=VLOOKUP(E2,Rates!$B$3:$C$57,2,0)

I would like to add additional conditions to this formula so that it will look up the values of each cell in column A and B to return the corresponding value from the Rates sheet into column C.
I'm trying to decide what's the best way to do it.

DETAILS
POSITION (A)TYPE (B)RATE (C)
MANAGERST
SUPERVISOROT
WORKERST
WORKERDT
SUPERVISORDT
WORKERDT


RATES
POSITIONSTOTDT
MANAGER172220294
SUPERVISOR169217290
WORKER150175200

So...if vlookup finds Manager and ST, it will return 172, Supervisor and DT will return 290, Worker and OT will return 175, etc.

Suggestions would be much appreciated!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I think this should do it but I did not set up a test case.

Excel Formula:
=INDEX(Sheet2!$A$1:$D$3,MATCH($A2,Sheet2!$A:$A,0),MATCH($B2,Sheet2!$1:$1,0))
 
Upvote 0
Welcome to the MrExcel board!

Does this do what you want?

mrstivoaddict.xlsm
ABCD
1POSITIONSTOTDT
2MANAGER172220294
3SUPERVISOR169217290
4WORKER150175200
RATES


mrstivoaddict.xlsm
ABC
1POSITION (A)TYPE (B)RATE (C)
2MANAGERST172
3SUPERVISOROT217
4WORKERST150
5WORKERDT200
6SUPERVISORDT290
7WORKERDT200
DETAILS
Cell Formulas
RangeFormula
C2:C7C2=SUMPRODUCT((RATES!A$2:A$4=A2)*(RATES!B$1:D$1=B2),RATES!B$2:D$4)
 
Upvote 0
Solution
Welcome to the MrExcel board!

Does this do what you want?

mrstivoaddict.xlsm
ABCD
1POSITIONSTOTDT
2MANAGER172220294
3SUPERVISOR169217290
4WORKER150175200
RATES


mrstivoaddict.xlsm
ABC
1POSITION (A)TYPE (B)RATE (C)
2MANAGERST172
3SUPERVISOROT217
4WORKERST150
5WORKERDT200
6SUPERVISORDT290
7WORKERDT200
DETAILS
Cell Formulas
RangeFormula
C2:C7C2=SUMPRODUCT((RATES!A$2:A$4=A2)*(RATES!B$1:D$1=B2),RATES!B$2:D$4)
Thank you so much, this is exactly what I needed. Now I have to figure out why it's not working in my spreadsheet!
 
Upvote 0
Now I have to figure out why it's not working in my spreadsheet!
In what way is it not working for you? Perhaps all the formulas are returning 0 because the values in 'RATES' are Text not actual Numbers? If so, try this instead
Excel Formula:
=SUMPRODUCT((RATES!A$2:A$4=A2)*(RATES!B$1:D$1=B2),--RATES!B$2:D$4)
 
Upvote 0
1724241264363.png

They are formatted as numbers, I just double checked. At least if it gave me an error I would know where to start!
 
Upvote 0
They are formatted as numbers
Formatting as numbers does not necessarily mean the underlying values are numbers. Did you try the formula from post #5?

We cannot tell much from an image (we cannot see what worksheet or what range that is) and we cannot copy from it for testing, and we certainly cannot see the other worksheet. Perhaps you could give small samples of both worksheets with XL2BB like I did?
(If you have trouble with XL2BB review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of theXL2BB Instructions page linked above.)

Failing that can you upload a small sample workbook where the formula is failing to DropBox or OneDrive or Google Drive etc and provide a publicly shared link here?
 
Upvote 0
Formatting as numbers does not necessarily mean the underlying values are numbers. Did you try the formula from post #5?

We cannot tell much from an image (we cannot see what worksheet or what range that is) and we cannot copy from it for testing, and we certainly cannot see the other worksheet. Perhaps you could give small samples of both worksheets with XL2BB like I did?
(If you have trouble with XL2BB review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of theXL2BB Instructions page linked above.)

Failing that can you upload a small sample workbook where the formula is failing to DropBox or OneDrive or Google Drive etc and provide a publicly shared link here?
I did try the other formula, same result. I will try to upload a sample.
 
Upvote 0
Thanks for access to the file. There are two issues:
  1. The values in 'Rates' C3:E3 are not just "ST", "OT" and "DT", they each have 9 space characters after them - see my LEN() formulas below. So get rid of the space characters in those headings.

  2. The second problem is your formula ...
    =SUMPRODUCT((Rates!B$5:B$54=C8)*(Rates!C$4:E$4=E8),Rates!C$5:E$54)
    ... it is looking for those ST/OT/DT headings in row 4 when they are actually in row 3 of 'Rates'

mrst SAMPLE.xlsx
BCDE
1111111
2LABOR RATES
3POSITION OR TITLEST OT DT
4N/A0.000.000.00
5Manager150.00175.00200.00
6Supervisor125.00150.00175.00
7Worker100.00125.00150.00
Rates
Cell Formulas
RangeFormula
C1:E1C1=LEN(C3)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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