Is this even possible? VBA question about adding rows for blank data...

nkemp15

New Member
Joined
Jan 31, 2014
Messages
36
I have a report that I run that will pull data for how many calls a team received for every 15 minute interval of the day. The issue I'm having with this report, is if there were no calls received, no data is put on the report. For example, it will give information for 1:00 1:15 1:30 2:00 & 2:15. In my example, no calls were received between 1:45 and 2:00, so 1:45 is completely missing from the report.

Is it possible to write a VBA script that will look through the times, and add in the missing rows with the blank times? I don't need any other data (since it would all be zeros anyways) I just need the rows to be added so management can visualize the times with zero calls.
 
From 6 in the morning to 12 at night?. Wow! Now that's something
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Yeah, the day on the screenshot was a Saturday so there weren't that many calls. But my department covers 6 time zones and our report shows everything in +5 time.
 
Upvote 0
Yeah, the day on the screenshot was a Saturday so there weren't that many calls. But my department covers 6 time zones and our report shows everything in +5 time.

Not sure how the time zone impacts the calculations yet.

Anyways, apologies if am asking too many questions, we need to be on the same page to get the macro working flawlessly

Between Rows 31 and 32, 1.e 6pm on 2/1/2014 till 9am on 2/2/2014...how do we fill it? we include rows to cover from 6PM till 12Am and another to start 9AM to cover till 9AM on the next day?

Is that right?
 
Upvote 0
Yeah. That would be ideal. But if it just did all times that wouldn't matter. I can delete 6 hours.
 
Upvote 0
Funny enough a similar code to the one i posted before seems to work for me

Code:
Sub addtimes()
    Dim I As Integer, j As Integer
    For I = Range("A" & Rows.Count).End(xlUp).Row To 3 Step -1
        a = 1 * Format(48 * (Range("A" & I) - Range("A" & I - 1)), "#")
        If a <> 1 Then
            For j = 1 To a - 1
                Rows(I).Resize(1).Insert
                Range("A" & I).Value = Range("A" & I + 1).Value - 1 / 48
                Range("B" & I).Value = 0
            Next j
        End If
    Next I
    
End Sub

If you get any errors, let me know, you might need to send a sample excel sheet with the exact structure o data even though fictitious data
 
Upvote 0
I have a report that I run that will pull data for how many calls a team received for every 15 minute interval of the day. The issue I'm having with this report, is if there were no calls received, no data is put on the report. For example, it will give information for 1:00 1:15 1:30 2:00 & 2:15. In my example, no calls were received between 1:45 and 2:00, so 1:45 is completely missing from the report.

Is it possible to write a VBA script that will look through the times, and add in the missing rows with the blank times? I don't need any other data (since it would all be zeros anyways) I just need the rows to be added so management can visualize the times with zero calls.
There's what seems to be a similar problem in this recent thread

http://www.mrexcel.com/forum/excel-questions/766334-data-missing-seris-dates-anybody-can-help.html

Post #10 there has a code resolving that particular problem.

Maybe your current problem is sufficiently similar.
 
Upvote 0

Forum statistics

Threads
1,215,337
Messages
6,124,340
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