VBA to auto-pivot and arrange 3 columns of data

alexcon

New Member
Joined
Dec 29, 2017
Messages
20
DescriptionDateValue
Item 12016/01/260.01399
Item 22016/07/180.17513
Item 32016/06/130.02468
Item 12016/08/150.01452

<tbody>
</tbody>


This runs down thousands of rows with various dates and values and descriptions in a sheet called "Data Capture". The descriptions periodically repeat but at different dates and values (e.g. Item 1). More rows are constantly added, so a VBA macro to auto-pivot and arrange as follows into an already existing sheet called "Clean Pivot" would help a lot.

A simple manual pivot results in the following: [edit: values are changed from Sum to Avg in the pivot]

https://ibb.co/droSzw

And after a manual cleanup it results in this usable format:

https://ibb.co/j0VwsG

The cleanup involves

1) removing the first to rows,
2) removing all the "Total" and "Grand Total" columns.
3) removing the "1900" column. (Don't know why it's there in the first place)
4) Renaming "Row Labels" to "Description"
5) Changing the date format to MMM-YY so for example that it runs Dec-16 (Dec 2016) over to Jan-17 (Jan 2017) seamlessly.
6) Converting it from a Range to a Table.

Once it's in this usable format, I've got a number of other macros that I can run.
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

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