Script to Count Number of Days Between Velocity Levels

nirvehex

Well-known Member
Joined
Jul 27, 2011
Messages
505
Office Version
  1. 365
Platform
  1. Windows
Hi All - looking for some help with a VBA script to do the following:

I have a master list with just over 5000 rows of data.

Column A is formatted as a date (ex: 5/6/17). Note that sometimes there is the same service day two or more times for the same unique identifier.
Column C is my unique identifier (there are 25 different unique identifiers, but this could change with other data sets).
Column L is a velocity level and formatted as a number (ex: 10, 0, 20, 25, 100, etc). Note, this number is always between 0 and 100.

One a second sheet, called "List," I have all 25 unique identifiers transposed across row 2 with the first one in column A and the last one in column Y. What I'm hoping to do is, starting in row 3 going down is for the script to put in the number of days until the velocity level is greater than or equal to 90.

So essentially the loop would do something like this:

On Master List tab:

For each unique identifier:
1. Count # of days until velocity level >=90 starting from row 2 working down
2. Then go to next service date where velocity level = 0
3. And count # of service days until velocity level >=90
4. Then go to next service date where velocity level = 0
Loop to step 1.
Next unique identifier

I would like to record each # of days until velocity level >=90 on the "List" tab underneath each respective unique identifier.

I've attached a link to a sample file with the first row of days until velocity level >= 90 populated on the list tab for the first unique identifier.

I think my (very manual) approach would be to filter for each unique ID in column C, then look at the max date and the min date between the first row of data for that unique identifier and the row before the velocity level >=90 and calculate the difference. So for the first data point on the list tab I have 21 days.

https://drive.google.com/open?id=0B_o_PsSgIw_-OGpoc2FSYmxTVjA

Thank you!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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