Lookup Data from Vertical to Horizontal

kumara_faith

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

I have the following data table:

Book1
ABCDEFGHIJKLMNO
1200720082009201020112012201320142015201620172018201920202021
2ENRSCONSINFTREALUTILFINLCONDREALCONDENRSINFTHLTHINFTINFTENRS
334.40%-15.40%61.70%32.30%19.90%28.80%43.10%30.20%10.10%27.40%38.80%6.50%50.30%43.90%45.60%
4MATRHLTHMATRCONDCONSCONDHLTHUTILHLTHTELSMATRUTILTELSCONDFINL
522.50%-22.80%48.60%27.70%14.00%23.90%41.50%29.00%6.90%23.50%23.80%4.10%32.70%33.30%25.70%
6UTILUTILCONDINDUHLTHREALINDUHLTHCONSFINLCONDCONDFINLTELSREAL
719.40%-29.00%41.30%26.70%12.70%19.70%40.70%25.30%6.60%22.80%23.00%0.80%32.10%23.60%23.30%
8INFTTELSREALMATRREALTELSFINLINFTINFTINDUFINLINFTS&PMATRTELS
916.30%-30.50%27.10%22.20%11.40%18.30%35.60%20.10%5.90%18.90%22.20%-0.30%31.50%20.70%19.70%
10CONSCONDS&PENRSTELSHLTHS&PCONSREALMATRHLTHREALINDUS&PINDU
1114.20%-33.50%26.50%20.50%6.30%17.90%32.40%16.00%4.70%16.70%22.10%-2.20%29.40%18.40%16.40%
12INDUENRSINDUTELSCONDS&PINFTFINLTELSUTILS&PS&PREALHLTHS&P
1312.00%-34.90%20.90%19.00%6.10%16.00%28.40%15.20%3.40%16.30%21.80%-4.40%29.00%13.50%15.30%
14TELSS&PHLTHS&PENRSINDUCONSS&PS&PINFTINDUCONSCONDINDUMATR
1511.90%-37.00%19.70%15.10%4.70%15.40%26.10%13.70%1.40%13.90%21.00%-8.40%27.90%11.10%14.50%
16HLTHINDUFINLCONSINFTMATRMATRINDUFINLS&PCONSTELSCONSCONSINFT
177.20%-39.90%17.20%14.10%2.40%15.00%25.60%9.80%-1.50%12.00%13.50%-12.50%27.60%10.80%13.80%
18S&PREALCONSFINLS&PINFTENRSCONDINDUCONDUTILFINLUTILUTILHLTH
195.50%-42.30%14.90%12.10%2.10%14.80%25.10%9.70%-2.50%6.00%12.10%-13.00%26.40%0.50%11.90%
20CONDINFTENRSINFTINDUCONSUTILMATRUTILCONSREALINDUMATRFINLCOND
21-13.20%-43.10%13.80%10.20%-0.60%10.80%13.20%6.90%-4.80%5.40%10.90%-13.30%24.60%-1.70%10.30%
22REALMATRUTILUTILMATRENRSTELSTELSMATRREALENRSMATRHLTHREALCONS
23-17.90%-45.70%11.90%5.50%-9.60%4.60%11.50%3.00%-8.40%3.40%-1.00%-14.70%20.80%-2.20%5.00%
24FINLFINLTELSHLTHFINLUTILREALENRSENRSHLTHTELSENRSENRSENRSUTIL
25-18.60%-55.30%8.90%2.90%-17.10%1.30%1.60%-7.80%-21.10%-2.70%-1.30%-18.10%11.80%-33.70%2.40%
Sheet1


I am trying to rearrange the data in the following format:

Book1
QRSTUVWXYZAAABACADAEAFAG
2AbbrDesc200720082009201020112012201320142015201620172018201920202021
3INDUS&P 500 Industrials Index
4S&PS&P 500 Index
5INFTS&P 500 Information Technology Index
6ENRSS&P 500 Energy Index
7REALS&P 500 Real Estate Index
8MATRS&P 500 Materials Index
9CONDS&P 500 Consumer Discretionary Index
10TELSS&P 500 Communication Services Index
11FINLS&P 500 Financials Index
12UTILS&P 500 Utilities Index
13CONSS&P 500 Consumer Staples Index
14HLTHS&P 500 Health Care Index
Sheet1


I tried using xlookup but it did not work. Appreciate all the help.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Another option, without volatile functions
Excel Formula:
=INDEX(A$2:A$25,MATCH($Q2,A$2:A$25,0)+1)
 
Upvote 0
Solution
Hi Andy B and Fluff,

Thank you and appreciate your valuable time and patience. Both worked. Have a great day ahead.?
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Here is an alternative solution for you. Power Query also called Get and Transform Data and found on the Data Tab of the Ribbon

Book1
ABCDEFGHIJKLMNOP
1Value200720082009201020112012201320142015201620172018201920202021
2COND-0.132-0.3350.4130.2770.0610.2390.4310.0970.1010.060.230.0080.2790.3330.103
3CONS0.142-0.1540.1490.1410.140.1080.2610.160.0660.0540.135-0.0840.2760.1080.05
4ENRS0.344-0.3490.1380.2050.0470.0460.251-0.078-0.2110.274-0.01-0.1810.118-0.3370.456
5FINL-0.186-0.5530.1720.121-0.1710.2880.3560.152-0.0150.2280.222-0.130.321-0.0170.257
6HLTH0.072-0.2280.1970.0290.1270.1790.4150.2530.069-0.0270.2210.0650.2080.1350.119
7INDU0.12-0.3990.2090.267-0.0060.1540.4070.098-0.0250.1890.21-0.1330.2940.1110.164
8INFT0.163-0.4310.6170.1020.0240.1480.2840.2010.0590.1390.388-0.0030.5030.4390.138
9MATR0.225-0.4570.4860.222-0.0960.150.2560.069-0.0840.1670.238-0.1470.2460.2070.145
10REAL-0.179-0.4230.2710.3230.1140.1970.0160.3020.0470.0340.109-0.0220.29-0.0220.233
11S&P0.055-0.370.2650.1510.0210.160.3240.1370.0140.120.218-0.0440.3150.1840.153
12TELS0.119-0.3050.0890.190.0630.1830.1150.030.0340.235-0.013-0.1250.3270.2360.197
13UTIL0.194-0.290.1190.0550.1990.0130.1320.29-0.0480.1630.1210.0410.2640.0050.024
Table1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Demoted Headers" = Table.DemoteHeaders(Source),
    #"Transposed Table" = Table.Transpose(#"Demoted Headers"),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Transposed Table", {"Column1"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Custom", each if Value.Is([Value], type number) then [Value] else null),
    #"Filled Up" = Table.FillUp(#"Added Custom",{"Custom"}),
    #"Added Custom1" = Table.AddColumn(#"Filled Up", "Custom.1", each if Value.Is([Value],type number) then null else 1),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom1", each ([Custom.1] = 1)),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Column1", "Value", "Custom"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Other Columns", List.Distinct(#"Removed Other Columns"[Column1]), "Column1", "Custom")
in
    #"Pivoted Column"
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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