Single Rows to Multiple Rows - Complex

Jess709

New Member
Joined
Apr 24, 2015
Messages
20
I am trying to provide payment information for a client on a per day basis in Excel. My current payment report has a line for each payment and that payment has a "pay from date" and a "pay through date". For example a payment dated today may have a payment from date of 11/2/17 and a pay through date of 11/8/17.

My client is requesting to have a line for each day of that particular payment for that specific employee. So in the example above instead of one line with a payment of $700 for 11/2/17-11/8/17 we would want 7 lines and each line would be for 1 day of the pay from and through period.

I also need to split out the payment amount among the number of days. In my example on each of the 7 lines I would have a payment amount of $100.

Below is an example of what my original date would look like and what I need the final output to look like. I'm trying to find a way to automate the final report in anyway possible.


Thank you so much for any assistance this great group can provide!!!

ORIGINAL DATA
Claim NumberEE IDEE First NameEE Last NamePayment DatePay From DatePay Through DatePayment Amount
12345611897045SusieSmith11/9/201711/2/201711/8/2017$700
End Result of Customer Request - Trying to Automate
Claim NumberEE IDEE First NameEE Last NamePayment DatePay From DayPay Through DatePayment Amount
12345611897045SusieSmith11/9/201711/2/201711/2/2017$100
12345611897045SusieSmith11/9/201711/3/201711/3/2017$100
12345611897045SusieSmith11/9/201711/4/201711/4/2017$100
12345611897045SusieSmith11/9/201711/5/201711/5/2017$100
12345611897045SusieSmith11/9/201711/6/201711/6/2017$100
12345611897045SusieSmith11/9/201711/7/201711/7/2017$100
12345611897045SusieSmith11/9/201711/8/201711/8/2017$100

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

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi
Try
Code:
Sub Splitrows()

    Dim Cnt As Long
    Dim Rw As Long
    
    For Rw = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
        Cnt = Range("G" & Rw).Value - Range("F" & Rw).Value + 1
        Rows(Rw + 1).Resize(Cnt - 1).Insert
        Rows(Rw).Resize(Cnt).FillDown
        Range("H" & Rw).Resize(Cnt).Value = Range("H" & Rw).Value / Cnt
        Range("F" & Rw).AutoFill Range("F" & Rw).Resize(Cnt), xlFillSeries
        Range("G" & Rw).Resize(Cnt).Value = Range("F" & Rw).Resize(Cnt).Value
    Next Rw

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,977
Members
449,200
Latest member
Jamil ahmed

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