2 hlookup and a vlookup

Jak7217

New Member
Joined
Jan 11, 2019
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Hey All:

I've got a big workbook and I have simplified my issue with example data below.

Is it possible to have 2 horizontal lookups and a vertical? Here is a snippet of hypothetical data and results. I've used nested index match before, but I can't get it to work here.

Can you write this so that Data is on Sheet1 and Output is on Sheet2? The data will have blank rows and columns periodically, so the formula has to be hearty.

1703801323621.png
1703801333756.png


Thanks in advance!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hey me again. You can choose to use sumproduct again, but like I said it's a matter that can go beyond me.
In your case here, index match will not work properly since it searches by column and row. Sumifs can work too but may encounter some issues.
=sumifs('Data'!$B$4:$E$6,'Data'!$2:$2,'Output'!$A3,'Data'!$3:$3,'Output'!$B3,$A:$A,C$2)

Try inputting this into Output!C3:
=sumproduct(('Data'!$2:$2='Output'!$A3)*('Data'!$3:$3='Output'!$B3)*($A:$A=C$2)*($B$4:$E$6)
~where 'Data'!$2:$2 is your first names
~'Data'!$3:$3 is your last names
~$A:$A is your years
~$B$4:$E$6 is your data
Then copy and fill the rest of the cells. It should work.
 
Upvote 0
Since you have MS365 you have a lot more options.
If you are happy to use formatting to hide the zeroes then this should work:

20231229 2 Way lookup Jak7217.xlsx
ABCDE
1FirstLast201820192020
2BobA567
3RonA000
4ToddA000
5BobB8910
Sheet2
Cell Formulas
RangeFormula
C2:E5C2=XLOOKUP(C$1, Sheet1!$A$3:$A$5, XLOOKUP(1, (Sheet1!$B$1:$E$1=$A2)*(Sheet1!$B$2:$E$2=$B2), Sheet1!$B$3:$E$5, ""), "")



If you don't want to use custom formatting to hide the zeroes you could change it to the this,
PS: Click on the copy icon in the top right corner than paste it into the formula bar in C2
Excel Formula:
=LET(result, XLOOKUP(C$1,
                                        Sheet1!$A$3:$A$5,
                                        XLOOKUP(1,
                                                         (Sheet1!$B$1:$E$1=$A2)*(Sheet1!$B$2:$E$2=$B2),
                                                         Sheet1!$B$3:$E$5,
                                                         ""),
                                         ""),
            IF(result = 0, "", result))
 
Upvote 0
Dont know if it will work for you but it seems you just need to transpose you data.

In sheet 2 use:
If you like to hide with formatting:
Excel Formula:
=TRANSPOSE(Sheet1!A2:E6)

If you like to hide zeros without formatting:
Excel Formula:
=LET(d, TRANSPOSE(Sheet1!A2:E6), IF(d = 0, "", d))
 
Upvote 0

Forum statistics

Threads
1,215,140
Messages
6,123,269
Members
449,093
Latest member
Vincent Khandagale

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