SOLVED

Excel Table Transform

%3CLINGO-SUB%20id%3D%22lingo-sub-1240066%22%20slang%3D%22en-US%22%3EExcel%20Table%20Transform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1240066%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%26nbsp%3B%20I%20have%20a%20table%20with%20PO%20numbers%20as%20column%20headers%20and%20a%20variable%20number%20of%20populated%20row%20below%20each%20PO%20number%20header%20corresponding%20to%20serial%20numbers%20(I%20did%20not%20set%20it%20up%20this%20way%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%20).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20easy%20way%20to%20transform%20this%20to%20just%20two%20columns%3F%26nbsp%3B%20The%20first%20column%20being%20the%20PO%20%23s%20and%20the%202nd%20column%20being%20the%20Serial%20Numbers.%26nbsp%3B%20The%20PO%20would%20just%20be%20repeated%20as%20many%20times%20as%20necessary%20so%20all%20rows%20included%20both%20the%20PO%23%20in%20column%201%20and%20one%20serial%20number%20in%20column%202.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(note%20there%20won't%20necessarily%20be%20any%20orderly%20pattern%20to%20the%20serial%20numbers%20in%20the%20table)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI.e.%20from%3A%3C%2FP%3E%3CTABLE%20border%3D%220%22%20width%3D%22256%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2264%22%20height%3D%2220%22%3EPO%20A%3C%2FTD%3E%3CTD%20width%3D%2264%22%3EPO%20B%3C%2FTD%3E%3CTD%20width%3D%2264%22%3EPO%20C%3C%2FTD%3E%3CTD%20width%3D%2264%22%3EPO%20D%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3ESN01%3C%2FTD%3E%3CTD%3ESN05%3C%2FTD%3E%3CTD%3ESN14%3C%2FTD%3E%3CTD%3ESN22%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3ESN02%3C%2FTD%3E%3CTD%3ESN06%3C%2FTD%3E%3CTD%3ESN15%3C%2FTD%3E%3CTD%3ESN23%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3ESN03%3C%2FTD%3E%3CTD%3ESN07%3C%2FTD%3E%3CTD%3ESN16%3C%2FTD%3E%3CTD%3ESN24%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3ESN04%3C%2FTD%3E%3CTD%3ESN08%3C%2FTD%3E%3CTD%3ESN17%3C%2FTD%3E%3CTD%3ESN25%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3ESN09%3C%2FTD%3E%3CTD%3ESN18%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3ESN10%3C%2FTD%3E%3CTD%3ESN19%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3ESN11%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3ESN12%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3ESN13%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%3A%3C%2FP%3E%3CTABLE%20border%3D%220%22%20width%3D%22128%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2264%22%20height%3D%2220%22%3EPO%20A%3C%2FTD%3E%3CTD%20width%3D%2264%22%3ESN01%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20A%3C%2FTD%3E%3CTD%3ESN02%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20A%3C%2FTD%3E%3CTD%3ESN03%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20A%3C%2FTD%3E%3CTD%3ESN04%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN05%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN06%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN07%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN08%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN09%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN10%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN11%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN12%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20B%3C%2FTD%3E%3CTD%3ESN13%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20C%3C%2FTD%3E%3CTD%3ESN14%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20C%3C%2FTD%3E%3CTD%3ESN15%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20C%3C%2FTD%3E%3CTD%3ESN16%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20C%3C%2FTD%3E%3CTD%3ESN17%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20C%3C%2FTD%3E%3CTD%3ESN18%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20C%3C%2FTD%3E%3CTD%3ESN19%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20D%3C%2FTD%3E%3CTD%3ESN22%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20D%3C%2FTD%3E%3CTD%3ESN23%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20D%3C%2FTD%3E%3CTD%3ESN24%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2220%22%3EPO%20D%3C%2FTD%3E%3CTD%3ESN25%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1240066%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1240490%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Table%20Transform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1240490%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587700%22%20target%3D%22_blank%22%3E%40alm958%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPower%20Query%20is%20the%20easiest%20way%20to%20achieve%20the%20desired%20output.%3C%2FP%3E%3CP%3EThere%20are%20two%20tabs%20in%20the%20attached...%3C%2FP%3E%3CP%3E1)%20Original%20Data%3A%20Which%20contains%20your%20raw%20data.%20I%20converted%20this%20data%20into%20an%20Excel%20Table%20and%20named%20it%20Data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2)%20Transformed%20Data%3A%20Which%20contains%20the%20data%20in%20the%20desired%20format.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFollow%20these%20steps%20to%20get%20the%20data%20in%20the%20desired%20format%20on%20Transformed%20Data%20Sheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1)%20Click%20inside%20the%20Table%20%22Data%22%20on%20the%20Original%20Data%20Sheet.%3C%2FP%3E%3CP%3E2)%20Go%20to%20Data%20Tab%20--%26gt%3B%20Get%20Data%20--%26gt%3B%20From%20Table%2FRange.%20Power%20Query%20Editor%20will%20be%20popped%20up%20with%20the%20data%20after%20this%20step.%3C%2FP%3E%3CP%3E3)%20On%20Power%20Query%20Editor%2C%20select%20the%20first%20column%20by%20clicking%20on%20the%20column%20header%20then%20hold%20down%20the%20Shift%20key%20and%20click%20the%20last%20column%20header.%20This%20will%20select%20all%20the%20columns.%3C%2FP%3E%3CP%3E4)%20Now%20Right%20click%20on%20one%20column%20header%20of%20the%20selected%20columns%20and%20choose%20%22Unpivot%20Columns%22.%3C%2FP%3E%3CP%3E5)%20Now%20double%20click%20the%20columns%20headers%20and%20rename%20them%20as%20PO%23%20and%20Serial%20Numbers.%3C%2FP%3E%3CP%3E6)%20Sort%20the%20PO%23%20columns%20in%20Ascending%20order.%3C%2FP%3E%3CP%3E7)%20Go%20to%20Home%20Table%20and%20click%20on%20Close%20%26amp%3B%20Load.%3C%2FP%3E%3CP%3EThe%20data%20will%20be%20transferred%20to%20a%20New%20Sheet%20in%20the%20form%20of%20an%20Excel%20Table.%20Rename%20the%20Sheet%20Tab%20as%20per%20your%20requirement.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20dynamic%20solution%20i.e.%20if%20you%20delete%20or%20add%20the%20data%20in%20the%20table%20on%20Original%20Data%20Sheet%2C%20come%20back%20to%20the%20Table%20returned%20on%20the%20New%20Sheet%20by%20Power%20Query%2C%20right%20click%20on%20any%20cell%20in%20that%20table%20and%20choose%20Refresh%20and%20the%20Table%20will%20be%20updated%20accordingly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20find%20the%20attached%20for%20more%20details.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1246927%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Table%20Transform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1246927%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20so%20much%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E.%26nbsp%3B%20That%20worked%20perfectly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%20and%20stay%20safe.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247193%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Table%20Transform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247193%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587700%22%20target%3D%22_blank%22%3E%40alm958%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou're%20welcome!%20Glad%20it%20worked%20as%20desired.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%20you%20too.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1660774%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Table%20Transform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1660774%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%20wonder%20if%20you%20can%20help%20with%20Excel%20on%20my%20Mac%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20some%20reason%20I%20am%20not%20able%20to%20see%20the%20get%20data%20tabs%20on%20my%20excel%20-%20screenshot%20attached.%20Can%20u%20please%20help%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1661123%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Table%20Transform%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1661123%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F791435%22%20target%3D%22_blank%22%3E%40kantshah%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20you%20can%20do%20is%2C%20build%20your%20Power%20Query%20solution%20in%20Excel%20on%20Windows%2C%20save%20the%20file%20on%20Mac%20and%20then%20change%20the%20source%20path%20as%20shown%20in%20this%20%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1VRrPPkMGs8%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Evideo%3C%2FA%3E.%20See%20if%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,  I have a table with PO numbers as column headers and a variable number of populated row below each PO number header corresponding to serial numbers (I did not set it up this way ).

 

Is there any easy way to transform this to just two columns?  The first column being the PO #s and the 2nd column being the Serial Numbers.  The PO would just be repeated as many times as necessary so all rows included both the PO# in column 1 and one serial number in column 2.

 

(note there won't necessarily be any orderly pattern to the serial numbers in the table)

 

I.e. from:

PO APO BPO CPO D
SN01SN05SN14SN22
SN02SN06SN15SN23
SN03SN07SN16SN24
SN04SN08SN17SN25
 SN09SN18 
 SN10SN19 
 SN11  
 SN12  
 SN13  

 

To:

PO ASN01
PO ASN02
PO ASN03
PO ASN04
PO BSN05
PO BSN06
PO BSN07
PO BSN08
PO BSN09
PO BSN10
PO BSN11
PO BSN12
PO BSN13
PO CSN14
PO CSN15
PO CSN16
PO CSN17
PO CSN18
PO CSN19
PO DSN22
PO DSN23
PO DSN24
PO DSN25
5 Replies
Best Response confirmed by alm958 (New Contributor)
Solution

@alm958 

Power Query is the easiest way to achieve the desired output.

There are two tabs in the attached...

1) Original Data: Which contains your raw data. I converted this data into an Excel Table and named it Data.

 

2) Transformed Data: Which contains the data in the desired format.

 

Follow these steps to get the data in the desired format on Transformed Data Sheet.

 

1) Click inside the Table "Data" on the Original Data Sheet.

2) Go to Data Tab --> Get Data --> From Table/Range. Power Query Editor will be popped up with the data after this step.

3) On Power Query Editor, select the first column by clicking on the column header then hold down the Shift key and click the last column header. This will select all the columns.

4) Now Right click on one column header of the selected columns and choose "Unpivot Columns".

5) Now double click the columns headers and rename them as PO# and Serial Numbers.

6) Sort the PO# columns in Ascending order.

7) Go to Home Table and click on Close & Load.

The data will be transferred to a New Sheet in the form of an Excel Table. Rename the Sheet Tab as per your requirement.

 

This is dynamic solution i.e. if you delete or add the data in the table on Original Data Sheet, come back to the Table returned on the New Sheet by Power Query, right click on any cell in that table and choose Refresh and the Table will be updated accordingly.

 

Please find the attached for more details.

 

Thank you so much @Subodh_Tiwari_sktneer.  That worked perfectly.

 

Cheers and stay safe.

@alm958 

You're welcome! Glad it worked as desired.

 

Thanks, you too.

Hi there, wonder if you can help with Excel on my Mac

 

For some reason I am not able to see the get data tabs on my excel - screenshot attached. Can u please help?

@kantshah 

All you can do is, build your Power Query solution in Excel on Windows, save the file on Mac and then change the source path as shown in this video. See if that helps.