Data manipulation question

tforthofer

New Member
Joined
Oct 9, 2014
Messages
5
Hello,

I have some data for some sales information that I am trying to organize in a different manner. I have around 5000+ row of data formatted like so:

Item #WhseItem # whse #Month 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11Month 12
196173619617.3628493378418491311933803214148287493461327816162212495332125
196175319617.533552018645267028937714400030295365953995015190
101153610115.361132724648100291325818494941736525133662191334791392310101
113443611344.3638686319324111261273590431832399972888624905366903745138522
197705319770.5310085178911448029382470916587263340411484612596334731373

<colgroup><col span="2"><col span="2"><col span="11"></colgroup><tbody>
</tbody>

I would like to have it look like this which me having to change the 5000+ lines every month.

Item # whse #
Date
Sales
19617.36Month 1
2,849.00
19617.36Month 2 33,784.00
19617.36Month 3 18,491.00
19617.36Month 4 31,193.00
19617.36Month 5 38,032.00
19617.36Month 6 14,148.00
19617.36Month 7 28,749.00
19617.36Month 8 34,613.00
19617.36Month 9 27,816.00
19617.36Month 10 16,221.00
19617.36Month 11 24,953.00
19617.36Month 12 32,125.00
19617.53Month 1 35,520.00
19617.53Month 2 18,645.00
19617.53Month 3 26,702.00
19617.53Month 4 8,937.00
19617.53Month 5 7,144.00
19617.53Month 6 -
19617.53Month 7 -
19617.53Month 8 -
19617.53
Month 9 30,295.00
19617.53Month 10 36,595.00
19617.53Month 11 39,950.00
19617.53Month 12 15,190.00

<colgroup><col><col><col></colgroup><tbody>
</tbody>


I'm stuggling to find a way that I can do this and is easy repeatable every month. Any help would be greatly appreciated.

Thanks,
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Welcome to the Board!

A macro can be created to do this.
Can you just confirm what row your data starts on, and what columns the data is found in?
 
Upvote 0
Code:
Sub transposeThings()
    'I should remember to save this macro in my macro sheet
    Dim raw As Worksheet
    Dim formatted As Worksheet
    Dim nextRow As Long
    
    nextRow = 2
    
    Set raw = Sheets("RAW") 'CHANGE ME
    Set formatted = Sheets("FORMATTED") 'CHANGE ME
    
    With formatted
        .Cells(1, 1) = "Item #/Whse #"
        .Cells(1, 2) = "Date"
        .Cells(1, 3) = "Sales"
    End With
    
    
    With raw
        For x = 2 To .Cells(Rows.Count, 1).End(xlUp).Row Step 1
            For y = 4 To 15
                formatted.Cells(nextRow, 1) = .Cells(x, 3)
                formatted.Cells(nextRow, 2) = .Cells(1, y)
                formatted.Cells(nextRow, 3) = .Cells(x, y)
                nextRow = nextRow + 1
            Next y
        Next x
    End With


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,360
Members
449,155
Latest member
ravioli44

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