Populate Data ans Rearrange

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
955
Office Version
  1. 365
Hi,

I have the following table:

Ariba Table Formula.xlsx
BCDEFGHIJKLMNO
1Table 1
2Data 1Data 2Data 3NameVol 1Vol 2Vol 3Vol 4Vol 5Vol 6Vol 7Vol 8Vol 9Vol 10
3ABVCABVCABVCMichale Nathan Williams10101010101010101010
4ABVCABVCABVCKerry Walley10101010101010101010
5ABVCABVCABVCMartinez China Buthen10101010101010101010
6
7
8Table 2
9Michale Nathan WilliamsTexas
10Amy Charles BaviewWashinton
11Kerry WalleyWashinton
12Mathew ValexTexas
13Martinez China ButhenWashinton
Sheet1 (2)


I am trying to match the names from Table 2 with the names in Table 1 and populate the data from Table 1 including the Table headers. In addition, I need the State and Name to be in the first two columns. I am currently using this formula:
Excel Formula:
=LET(
    data_with_state, HSTACK(
        B3:D5,
        XLOOKUP(FILTER(E3:E5, ISNUMBER(MATCH(E3:E5, E9:E13, 0))), E9:E13, F9:F13),
        E3:O5
    ),
    final_result, VSTACK(
        HSTACK(B2:D2, "State", E2:O2),
        FILTER(data_with_state, ISNUMBER(MATCH(E3:E5, E9:E13, 0)))
    ),
    final_result
)

However the result are as follows:
Ariba Table Formula.xlsx
QRSTUVWXYZAAABACADAE
30Data 1Data 2Data 3StateNameVol 1Vol 2Vol 3Vol 4Vol 5Vol 6Vol 7Vol 8Vol 9Vol 10
31ABVCABVCABVCTexasMichale Nathan Williams10101010101010101010
32ABVCABVCABVCWashintonKerry Walley10101010101010101010
33ABVCABVCABVCWashintonMartinez China Buthen10101010101010101010
Sheet1 (2)
Cell Formulas
RangeFormula
Q30:AE33Q30=LET( data_with_state, HSTACK( B3:D5, XLOOKUP(FILTER(E3:E5, ISNUMBER(MATCH(E3:E5, E9:E13, 0))), E9:E13, F9:F13), E3:O5 ), final_result, VSTACK( HSTACK(B2:D2, "State", E2:O2), FILTER(data_with_state, ISNUMBER(MATCH(E3:E5, E9:E13, 0))) ), final_result )
Dynamic array formulas.


The correct result should be as follows:

Ariba Table Formula.xlsx
QRSTUVWXYZAAABACADAE
36StateNameData 1Data 2Data 3Vol 1Vol 2Vol 3Vol 4Vol 5Vol 6Vol 7Vol 8Vol 9Vol 10
37TexasMichale Nathan WilliamsABVCABVCABVC10101010101010101010
38WashintonKerry WalleyABVCABVCABVC10101010101010101010
39WashintonMartinez China ButhenABVCABVCABVC10101010101010101010
Sheet1 (2)


Appreciate any help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
How about
Excel Formula:
=HSTACK(VSTACK("State",XLOOKUP(E3:E5,E9:E13,F9:F13)),CHOOSECOLS(B2:O5,4,1,2,3,SEQUENCE(,10,5)))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

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