Combining multiple columns within 1 table

Qliky66

New Member
Joined
Oct 7, 2016
Messages
9
Hi,

I have a list that is broken down by Transaction, but I need to change the orientation of it so the list is by the product (even if there are duplicate items) with all of the corresponding information from that specific transaction.
Since I'm not great at explaining I'll just get right into the example. I would really appreciate if someone could help me to figure out how to do this.

I have this table: information about the transaction/purchase, and then which product was purchased. Sometimes there's multiple products in multiple columns, sometimes there's just a single product

BuyerTransactionTimePlaceProduct 1Product 2Product 3Product 4
Joe30111:00City1OrangeBananaAppleWater
Bob30412:00City2AppleCat
Randy30811:30City1Dog
Joe31011:23City3OrangeBananaApple

<tbody>
</tbody>

So I would like to create a table using a formula/formulas to show this same table but oriented around the products -- with their corresponding Buyer, Transaction, Time, and Place information.

Its fine if the same product shows up twice, since it will have different transaction data. Like "orange" in this example".


ProductBuyerTransactionTimePlace
OrangeJoe30111:00City1
BananaJoe30111:00City1
AppleJoe30111:00City1
WaterJoe30111:00City1
AppleBob30412:00City2
CatBob30412:00City2
DogRandy30811:30City1
OrangeJoe31011:23City3
BananaJoe31011:23City3
AppleJoe31011:23City3

<tbody>
</tbody>




Thanks for any help you can provide!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
So I would like to create a table using a formula/formulas to show this same table but oriented around the products
I don't know that I would be able to do that via formula. I would probably use VBA to do it. Is that an acceptable solution?
 
Upvote 0
I agree with Joe4, this kind of reorganization is usually better left to a macro. Nevertheless, here is one way to do it with formulas:

ABCDEFGHIJKLMN
1BuyerTransactionTimePlaceProduct 1Product 2Product 3Product 4ProductBuyerTransactionTimePlace
2Joe30111:00City1OrangeBananaAppleWaterOrangeJoe30111:00City1
3Bob30412:00City2AppleCatBananaJoe30111:00City1
4Randy30811:30City1DogAppleJoe30111:00City1
5Joe31011:23City3OrangeBananaAppleWaterJoe30111:00City1
6AppleBob30412:00City2
7CatBob30412:00City2
8DogRandy30811:30City1
9OrangeJoe31011:23City3
10BananaJoe31011:23City3
11AppleJoe31011:23City3
12
13

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Array Formulas
CellFormula
J2{=IFERROR(INDIRECT(TEXT(SMALL(IF($E$2:$H$10<>"",ROW($E$2:$H$10)*100+COLUMN($E$2:$H$10)),ROWS($J$2:$J2)),"R00C00"),0),"")}
K2{=IF($J2="","",INDEX(A$2:A$10,SMALL(IF($E$2:$H$10<>"",ROW($E$2:$H$10)-ROW($A$2)+1),ROWS($K$2:$K2))))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



Put the J2 formula in, and confirm with Control+Shift+Enter. Drag down as needed. Put the K2 formula in, confirm with Control+Shift+Enter, then drag down and to the right as needed.
 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,030
Members
449,205
Latest member
Eggy66

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