Transform a table to use it in a pivottable

Joel Horowitz

New Member
Joined
Aug 23, 2002
Messages
34
Hye,

I sometimes have raw data in a format that does not make it easy to feed into a pivottable. For instance, I have a table like this

Date Prod1 Prod2 Prod3 Prod4
1/1 343 545 242 543
2/1 432 542 143 656
... ... ...

What I would like is a format like

Date Productname Sales
1/1 Prod1 343
1/1 Prod2 545
1/1 Prod3 242
1/1 Prod4 543
2/1 Prod1 432
... ... ...

In that particular instance, I can do it, via the mod() function and vlookup. However, sometimes the layout of the table is a little different, and I need to rethink how to program it. Is there a macro that can do it in a flexible way?

Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
To do it 'flexibly', the macro would have to be equally 'flexible', and that means programming in a lot of different scenarios, loads of error checking etc. I do't know of anything like it in the various addins out there, and I suspect it would be a very large task to build macro / wizard to do the job.

As ever, I'll wait to be proved wrong on this, but I don't think it's the sort of thing you'll get all in one go from a board. Maybe if you were trying to write one & had specific problems on the way...

Paddy
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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