Xlookup or Index/match with multiple criteria help!

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a table that has below format and need to update the amount from different table that has a different format, I tried using Xlookup and Index/Match but for some reason it didn't work. Could anyone help me?

What I need to accomplish:

- The template I have has 3 columns (Employee ID, Effective Date & Amount) and all of these columns are blank. Is there a way that I could update the Employee ID and Effective date base on Table 2, rather than manually copying the 3 dates from table 2 (paste them into transpose to update the Effective Date column) and the 4 Employee ID (repeat 3 times)?
- Update the amount column from Table 2 in Table 1 (Amount column) based on the Effective Date and Employee ID




XLOOKUP with multiple criteria.xlsx
ABCDEFGHIJKLMN
1Table 1Table 2 (different workbook)
2Required ResultEmployee ID2022-03-312022-04-302022-05-31
3Employee IDEffective Date*AmountAA$3,000.00$2,250.00$30,271.50
4AA2022-03-31$ 3,000.00BB$ -$5,000.00$16,321.50
5BB2022-03-31$ -CC$1,500.00$ -$15,856.50
6CC2022-03-31$ 1,500.00DD$3,250.00$2,050.00$ -
7DD2022-03-31$ 3,250.00
8AA2022-04-30$ 2,250.00
9BB2022-04-30$ 5,000.00
10CC2022-04-30$ -
11DD2022-04-30$ 2,050.00
12AA2022-05-31$ 30,271.50
13BB2022-05-31$ 16,321.50
14CC2022-05-31$ 15,856.50
15DD2022-05-31$ -
16
17
18
Sheet3
Cell Formulas
RangeFormula
J2J2=A3
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Well, this is pretty ugly but I think it works.

MyTbl is the name range for the DATA in the table that's to be used in the result. Your table2 I have on sheet1 in the same rows & columns as your example.
You'll have to change a few of the ranges and the name range if you add more Emp info and more dates.

Book31
ABC
3Employee IDEffective Date*Amount
4AA3/31/20223000
5BB3/31/2022$ -
6CC3/31/20221500
7DD3/31/20223250
8AA4/30/20222250
9BB4/30/20225000
10CC4/30/2022$ -
11DD4/30/20222050
12AA5/31/202230271.5
13BB5/31/202216321.5
14CC5/31/202215856.5
15DD5/31/2022$ -
Sheet2
Cell Formulas
RangeFormula
A4:A15A4=INDEX(Sheet1!J3:J6,1+MOD(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2))-1,COUNTA(Sheet1!J3:J6)))
B4:B15B4=INDEX(Sheet1!K2:M2,,INT(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2),,0,1/COUNTA(Sheet1!J3:J6)))+1)
C4:C15C4=OFFSET(MyTbl,MOD(ROW()-ROW($C$4),ROWS(MyTbl)),TRUNC((ROW()-ROW($C$4))/ROWS(MyTbl)),1,1)
Dynamic array formulas.
 
Last edited:
Upvote 0
Solution
Well, this is pretty ugly but I think it works.

MyTbl is the name range for the DATA in the table that's to be used in the result. Your table2 I have on sheet1 in the same rows & columns as your example.
You'll have to change a few of the ranges and the name range if you add more Emp info and more dates.

Book31
ABC
3Employee IDEffective Date*Amount
4AA3/31/20223000
5BB3/31/2022$ -
6CC3/31/20221500
7DD3/31/20223250
8AA4/30/20222250
9BB4/30/20225000
10CC4/30/2022$ -
11DD4/30/20222050
12AA5/31/202230271.5
13BB5/31/202216321.5
14CC5/31/202215856.5
15DD5/31/2022$ -
Sheet2
Cell Formulas
RangeFormula
A4:A15A4=INDEX(Sheet1!J3:J6,1+MOD(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2))-1,COUNTA(Sheet1!J3:J6)))
B4:B15B4=INDEX(Sheet1!K2:M2,,INT(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2),,0,1/COUNTA(Sheet1!J3:J6)))+1)
C4:C15C4=OFFSET(MyTbl,MOD(ROW()-ROW($C$4),ROWS(MyTbl)),TRUNC((ROW()-ROW($C$4))/ROWS(MyTbl)),1,1)
Dynamic array formulas.
Wow! That worked perfectly great, thank you for your help!
One more favor, could you please explain the 3 formulas you used, this would really help me with understanding your logic and maybe use it in a different situation.

RangeFormula
Cell Formulas
A4:A15A4=INDEX(Sheet1!J3:J6,1+MOD(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2))-1,COUNTA(Sheet1!J3:J6)))
B4:B15B4=INDEX(Sheet1!K2:M2,,INT(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2),,0,1/COUNTA(Sheet1!J3:J6)))+1)
C4:C15C4=OFFSET(MyTbl,MOD(ROW()-ROW($C$4),ROWS(MyTbl)),TRUNC((ROW()-ROW($C$4))/ROWS(MyTbl)),1,1)
 
Upvote 0
BTW, the late Chip Pearson gets full credit for the C column effort.

TableToColumn
Wow! That worked perfectly great, thank you for your help!
One more favor, could you please explain the 3 formulas you used, this would really help me with understanding your logic and maybe use it in a different situation.

Cell Formulas
RangeFormula
A4:A15A4=INDEX(Sheet1!J3:J6,1+MOD(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2))-1,COUNTA(Sheet1!J3:J6)))
B4:B15B4=INDEX(Sheet1!K2:M2,,INT(SEQUENCE(COUNTA(Sheet1!J3:J6)*COUNTA(Sheet1!K2:M2),,0,1/COUNTA(Sheet1!J3:J6)))+1)
C4:C15C4=OFFSET(MyTbl,MOD(ROW()-ROW($C$4),ROWS(MyTbl)),TRUNC((ROW()-ROW($C$4))/ROWS(MyTbl)),1,1)
I would suggest you read the description from the link to Pearson's site for the last one.

The product of the two COUNTA formulas is how many rows there are in the result. For example, A-D with 3 dates would be 4 times 3 = 12 rows.
Try the SEQUENCE function with a 12. In order to index the employee IDs (e.g., A to D), for example, I used the MOD function. The B column range was similar but used INT rather than MOD.
If you select portions of a formula and then use F9 on the keyboard, you'll the various intermediate results of using the functions.

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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