Transposing Budget line items from Col into Rows ( each Row has to be replicated 12 time for each month

ravisca2003

New Member
Joined
Jul 18, 2018
Messages
8
Hello Experts,
I am working on a budget file where users are given an excel template to fill in Budget data for each line item as follows ( I have give
1674712164798.png


We have another deptt who give us the erp based report where actuals which are booked under the planned head as follows
1674712398172.png


we are doing this recon in excel and also creating pivot reports to compare planned and actual numbers hence we need to convert our budget format into the actual format. Can someone suggest how we can achieve this
 

Attachments

  • 1674712145777.png
    1674712145777.png
    9.7 KB · Views: 9

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi
Try this
VBA Code:
Sub test()
Dim a
Dim i&, c&
a = Cells(1).CurrentRegion.Value2
Application.ScreenUpdating = False
Cells(1, 17).Resize(, 5) = Array(a(1, 1), a(1, 2), a(1, 3), "Month", "Amount")
For i = 2 To UBound(a)
        Cells(2 + c, 17).Resize(UBound(a, 2) - 3) = a(i, 1)
        Cells(2 + c, 18).Resize(UBound(a, 2) - 3) = a(i, 2)
        Cells(2 + c, 19).Resize(UBound(a, 2) - 3) = a(i, 3)
        Cells(2 + c, 20).Resize(UBound(a, 2) - 3) = Application.Transpose(Application.Index(a, 1, [{4,5,6,7,8,9,10,11,12,13,14,15}]))
        Cells(2 + c, 21).Resize(12) = Application.Transpose(Application.Index(a, i, [{4,5,6,7,8,9,10,11,12,13,14,15}]))
        c = c + UBound(a, 2) - 3
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Bring your data into the Power Query Editor and Unpivot the Data. If you provide your sample data in an XL2BB format, then we can manipulate the data and demonstrate to you specifically how this occurs.
 
Upvote 0
Bring your data into the Power Query Editor and Unpivot the Data. If you provide your sample data in an XL2BB format, then we can manipulate the data and demonstrate to you specifically how this occurs.
SIr , Thanks for your input as well as offer to help further. I am highly obliged. I will use VBA suggestion by mohadin as I have issues of excel version compatibility with power query but again thanks so much for helping
 
Upvote 0
Hi
Try this
VBA Code:
Sub test()
Dim a
Dim i&, c&
a = Cells(1).CurrentRegion.Value2
Application.ScreenUpdating = False
Cells(1, 17).Resize(, 5) = Array(a(1, 1), a(1, 2), a(1, 3), "Month", "Amount")
For i = 2 To UBound(a)
        Cells(2 + c, 17).Resize(UBound(a, 2) - 3) = a(i, 1)
        Cells(2 + c, 18).Resize(UBound(a, 2) - 3) = a(i, 2)
        Cells(2 + c, 19).Resize(UBound(a, 2) - 3) = a(i, 3)
        Cells(2 + c, 20).Resize(UBound(a, 2) - 3) = Application.Transpose(Application.Index(a, 1, [{4,5,6,7,8,9,10,11,12,13,14,15}]))
        Cells(2 + c, 21).Resize(12) = Application.Transpose(Application.Index(a, i, [{4,5,6,7,8,9,10,11,12,13,14,15}]))
        c = c + UBound(a, 2) - 3
Next
Application.ScreenUpdating = True
End Sub
hi I will try this
 
Upvote 0

Forum statistics

Threads
1,223,732
Messages
6,174,182
Members
452,550
Latest member
southernsquid2

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