Tracker
HOME    TRACKER    Excel

# Filling In Cells Based On Date Ranges

## I have the following: A/B/C/D/E/F/G/H/I/J/K April 2008 / August 2008/Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sept/Oct.... How can I get excel to fill in a constant number say '3' automatically based on the date range in column A and B. For example, in this case Since the date range is from April to August how can I get excel to automatically fill in 3 for apr/may/jun/jul/aug

Related Forum Messages:
Date Cells In Project Plan To Change Based On Other Cells Including Other Date Cells
This is a project plan with tasks and dates. Column A is the activity number. (Example 1, 2, 3" etc). Column B is the task (Ex. "Complete Report"). Column C is number of days required to complete the task. Column D is the dependency column. (Ex. Cell D2 =1 in other words Task 2 is dependent on task 1). Column E is the date.

I would like to have a seperate start date cell and a go live date cell.

The objective is to enter a start date, and have each column E date increase based on the number of days entered in Column C. If a task is dependent on another and I change the number of days in Column C I need the dependent task to change the same amount of days.

Summing Values Based On Date Ranges
summing monthly values based on different date ranges. For example if I have multiple contracts with different start and end dates and based on those date ranges, I want to sum the respective monthly production totals, how would I do that in a formula. I started to set up the table to include "start date month" and "# of months in contract". Is there a way to sum based on the start month and # of months in contract.

For example if hte contract started in Jan08 and ends in May08, the calculation would start with month "1" and sum over 4 months.

Here is an example: ....

AVERAGE IF Statement Based On Matching Condition And Date Ranges
I have created a spreadsheet which creates an average of feedback for trainers in a training company. The form adds up the feedback score into column L of the summary sheet and I have created a summary sheet which I want you use to calculate the average for each trainer.

I have cobbled together an array formula which creates the overallaverage for each trainer based on the named ranges entered via the form.

It looks something like this:

Counting Cells With Certain Date Ranges As Values
I need to count cells withdates in theme in a column. So that would be a CountA function; but only if the values in the cells are within a certain date range, a COUNTIF function. Here's what I thought:

=COUNTIF('All Employees'!O1351:O1364,">12/31/05,<2/1/06")

It returns a zero, which I know is not correct, as I checked it on a smaller sample....

Concatenate Cells Or Ranges Based On Conditions
I have a list of people to send drawings out to. I have already made the selections am just trying to work out how to simplify the output so as to use as a field in a data file to go onto a letter.

"| A01 | A02 | A03 | A04 | A05 | A06 | A07 |" are for Joe Bloggs
( | are cells)

In another cell, i would like to merge them together like so

"A01-A07" are for Joe Bloggs

And also as follows

"| A01 | | A03 | A04 | A05 | | A07 |" are for John Smith

would like this to be
"A01, A03-A05,A07" are for John Smith.

So differing conditions depending on what happens in the range. I have had a couple of attempts at this using a VBA concatenate command, I can get them to display like "A01,A02,A03..." with a selected separator, but cannot get it how i want it.

Populate Cells With Data Based On Conditions From Ranges
What formula do I use to populate certain cells (E5:E10 and J5:10) based on match with condition (E3) with cells from and in the ranges C2:C73 and D2:D73 without creating milelong IF formulas? I am almost at the goal... past 10pm here in Thailand and still at the office

Filling In A Column Based On Certain Criteria
I am trying to auto-fill a column based on certain criteria - in other words, fill in blank cells based on a cell above, just a little more complex version. I have added an attachment to give everyone a visual of what I am describing and then maybe this explanation will make a little more sense.

First, if you open the attachment, the left hand side is a small example of what I have. The middle is the condition. And the right hand side is what I'd like to see happene.

In the example, I am matching up a time and when I hit that time, I am adding on a certain number of miles per hours based on the condition and the cell above. Meanwhile, I am filling in the blank cells with the condition until the condition changes. So a cell is incremented based on the condition and gets its value from the cell above.

Filling Textbox Based On Combobox Selection
On a sheet named "Matrix" I have rows of data in columns A, B, and C. I have the following code in a ComboBox that will show names from column B of the Matrix sheet.

Move Ranges To Corresponding Ranges Based On Column Having Data
I need help creating a macro that will search through my excel spreadsheet and for every instance where column A isn't empty it should cut a range of columns from that row and paste them in a different range of columns in the row before it. It should then delete the row that it cut the columns from and keep searching until it has done this for the whole worksheet. I can modify which range of columns are needed, but it has been so long since I've worked with excel macros that I haven't been able to do it.

Date Range: Reference A Single Date And Output Date Ranges
I need to create formulas that reference a single date and output date ranges. The objective is to have a person input a Monday date in any given month and receive a four weeks out worth of dates and ranges. For example: In a lone cell, the person inputs 10/13/08. Automatically, the sheet produces the next full week range: October 19 – October 25 in a single cell and also produces a cell for each date. Example: Sunday 19, Monday 20, Tuesday 21, etc…. It should look like:

Monday Date:
10/13/08
October 19 – October 25
Sunday 19
Monday 20
Tuesday 21
Wednesday 22
Thursday 23
Friday 24
Saturday 25

and then repeat for three more weeks. I thought I had it figured out until the month changed. The dates continued in October instead of adding a month. This report will be ran weekly, so simply adding a +1MONTH to some cells will not benefit me as I’ll have to change the formula every week. I want the formula to compute the data without any manipulation over the next several years. The only change will be the Monday date.

Filling Up The Blank Cells
Got two columns one with group name and other with value. given below is the data which i have

Retail group25635012030Technology group24520520245Wholesale group24334024450
the green cells are blank , i want them to fill up by the group name i.e first four rows belong to retail group, so i want retail group to be filled in the blank cells upto technology group from thereon technology group to be filled in till whole sale group.

Filling Cells According To A Calculation
I have a spreadsheet that is designed to aid a production department to complete and track their orders. I need two things from this.

1) I have an order of 500 baskets. Baskets are stacked, but the heights vary from 16 to 20. I need the spreadsheet to be able to work this out for me.
Example:
500 baskets 20 high = 25 stacks.
500 baskets 16 high = 31 stacks and 4 baskets.

Excel would work the last equation out as 31.25. How can I get excel to use the remainder (in this case 0.25) to work out the required number of baskets?

2) Using the above, I need the sheet to fill out a certain area with information. So, if the order is 500 baskets at 20 high, I need 25 of the cells in the specific area to display the number 20. Likewise, if the order is 500 baskets at 16 high, I need 31 cells to display 16 and the remaining cell to show 4.

Filling Cells According To Time
I'm working on some data dealing with time fields, and I need to have them counted in 15 minute intervals.

For example, one of the entries listed in a column has an event starting at 02:25:00 and ending at 02:55:00 (30 minutes). Along the top row are times listed in 15-minute intervals, e.g. 13:00:00, 13:15:00, 13:30:00, etc. In the corresponding cells, if the entry took place within a particular interval, I need it to say "1", otherwise have it say "0" or "-" or something denoting no event.

An IF statement was used, but it didn't seem to work.

If that's a little hard to follow, check the example attachment for a better idea of what I'm trying to describe.

In the example spreadsheet, Row 2 (manually typed in) is what I'm looking for. Row 3 is the (failed) attempt to use the IF statement.

Automatically Filling Cells If A:C Match A:C
I'm looking for a formula that when copied down in row D would automatically fill in what is in colum D above if columns A:C match.

So,

If A25:C25=A1:C24 (for example A25:C25 = A8:C8) then D25 will automatically fill in the content of D8. Then next it would be A26:C26 match A1:A25 and so on.....

Filling In Blank Cells With Value From Another Cell
What I would like to do is to take the name values in column B and fill that into the region of blank cells below. I know that a special cells function could probably do this paired with a looping structure. I'm new to VBA and am trying to learn it so that I can use it comfortably.

Filling Blank Cells In A Column
I have 6,000 rows of check detail. The check number is listed in both columns B & C.

If the check paid multiple invoices the check number is not repeated in columns B & C.

I would like to fill the cells in those columns with the appropriate check number. Data looks something like this-

item ck_01 ck_02 vendor ck_date
1 10100 10100 ABC 09-01-09
2 10101 10101 ALLIED 09-01-09
3 ALLIED 09-01-09
4 ALLIED 09-01-09
5 10102 10102 BEACH 09-01-09
6 BEACH 09-01-09
7 10103 10103 CAP 09-01-09
8 10104 10104 DART 09-01-09

How can I fill the balnks with the check number (above)?

Filling In Information In Blank Cells
I have a sheet that has been created with a pivott table, and as such has a lot of blank cells in the description column, and I want to do a little macro to fill all of these. Basically, what I was thinking, was that the macro finds the last cell with data in it in column A. Then it moves up one cell and checks if its empty. If it is empty, then it copies the information from the cell immediatly below then moves up one and does it all again. If it is not empty then it just moves up one cell and does it all again.

Filling Cells With Data From Userforms
I have a userform and on it is a combo box with the weeks in each month in it. A user has to select a week to enter figures for and then enter the figures into text boxes on the same form. When the click submit (command button), based on what week they've already selected, my code will put the figures into the spreadsheet in the appropriate place.

Sub december1()
Worksheets("Dec").Activate
If Figures1.TextBox1.Value >= "1" Then Range("c16") = Figures1.TextBox1.Value
If Figures1.TextBox2.Value >= "1" Then Range("c17") = Val(Figures1.TextBox2.Value) / 100#
If Figures1.TextBox3.Value >= "1" Then Range("c18") = Figures1.TextBox3.Value
If Figures1.TextBox4.Value >= "1" Then Range("c22") = Figures1.TextBox4.Value
If Figures1.TextBox5.Value >= "1" Then Range("c23") = Figures1.TextBox5.Value
If Figures1.TextBox6.Value >= "1" Then Range("c28") = Figures1.TextBox6.Value
If Figures1.TextBox7.Value >= "1" Then Range("c29") = Val(Figures1.TextBox7.Value) / 100#...........................

Data Validation And Auto Filling Cells
Starting to struggle a bit here. Trying to create a user form, with help from this website I was able to create 2 dropdown lists based on data validation and information from another sheet in the same workbook. I have one cell B7 that uses data validation and sheet "Eq List" to create a drop down list of departments that the user can select from. Once B7 is filled in, it creates the 2nd dropdown list in B9 so the user can pick "Equip Desc".

Where I am trying to fill B11 which should automatically give me back the Mach ID that is related to B7 & B9. Am I going about this the right way? I have ttached a sample file to make it easier to understand.

Filling Empty Cells With The Right Data From Another Sheet
I got my invoice and my journal. Once I finish my invoices I send all to the journal, but I am having a little problem.... Here is my code

Filling In Multiple Cells After A Choice From A Drop Down List
If I choose 1 thing from a list I want it to then fill in many cells with info.

For example: I have a color list to choose from, once I make my choice cells near it fill in with 1.5lbs yellow, 2lbs blue, 4lbs red,.....or what ever I have established as the "recipe" for my color choice. When I choose a different color from my list these cells each fill in with different values.

Macro Code Executes Very Slowly: Filling Some Cells On Different Worksheets
I have the following code attached to a userform. It works perfectly (for what I need) although I know it may not be perfectly written. However it does seem to take for ever to execute considering it's just filling some cells on different worksheets. Have I missed something out or got it tied up doing something that takes a long time. If it's just a fact of life that it takes this time then I can live with it.

Private Sub UserForm_Activate()
Dim wsCB As Worksheet, wsLL As Worksheet, wsBond As Worksheet
Dim rngFound As Range
Set wsCB = Sheets("Current Bonds")
Set wsLL = Sheets("Landlords")
Set wsBond = Sheets("Bond")
TenancyStartTxt = Format(TenancyStartTxt, "dd-mmm-yy")
RnwlDteTx = Format(RnwlDteTx, "dd-mmm-yy")
Application. ScreenUpdating = False
10 MyBond = Application.InputBox("Bond number for renewal?", "Bond Number")
strFindMe = MyBond
With wsCB
Set rngData = .Range("c13:c490").......................

Hide Cells Based Upon Date
Is there anyway to have columns automatically be hidden based upon a cell value? I have a column for each month, and I would only like to show months that have occured, and keep future months hidden from view. I have the current month end date in cell a1 and the following columns each have a date as the header?

Update Cells Based On Date And Data Changes
Attached simplified sheet gives background - but need to update the cells in the aggregate monthly table C44:C55 based on data in single cell above, and according to the correct month. Need do this without the previous months data changing.

Month is determined by cell E8 and data to be updated to the agg month range is to come from cell C15. The month date will change automatically as will the data in C15.

Coloring Cell Based Off Of Other Cells Date
I am trying to make a certain cell range turn red on the week that a cell has listed.

What this is being used for is to track the work of our contractors, and I currently have this set up to auto calculate the jobs that are being done and when, but I would also like to include something in there that when the contractor is set to head back to India, that day forward is listed as "red" under his name. This will allow me to see if I need to extend his work based on the number of hours he has left in his jobs. I will attach the picture of it...on the top you will see dates, and the pivot table on the bottom shows when he will need new work, but I am going to add a field that has the date he is set to leave, this is what I want the coloring of fields to go off of! ...

Protecting/umprotecting Cells Based On Date
I have a spreadsheet that i use as a log for recording when certain tasks have been completed.

Each worksheet in the workbook represents one month. Within each month, there are monthly tasks and weekly tasks. Currently i manually unlock the relevant weekly cells at the beginning of each week, and lock them again at the start of the next week. Similarly with the monthly task cells.

Is there a way for Excel to automatically unlock the relevant cells based on date so i don't have to go through this task at the start of every week and every month?

Protect Cells Based On Computer's Date
I need to allow only the cells covered in the date (example today is 30 May) to be unlock for data entry. However i need the rest of the cells to be lock. The date should refer as =today().

Copy Cells From Sheets Based On Date, Paste To Another Sheet
On sheet "CoA" i have at table of periodic payments that is created via an input form and what I want to do is have accounting entries automatically generated in my cask book based on dates.

The code for the input form is as follows;

Color Cells Based On Date Match & Vlookup
The purpose of the attached spreadsheet is to record whether or not my company has stock of each item, on every day. It currently works by doing a VLOOKUP in each cell if the date matches todays date which is generated by the formula on the TOTALS tab, cell I2. The current days stock levels are refreshed by a database query on the DATA tab and then totaled up on the TOTALS tab. The VLOOKUP formula returns the stock level and if we are out of stock then we are manually formatting the relevant cell on the REPORT tab red.

It has been suggested to me that there might be a way to do this via conditional formatting although I cannot work out how as once the current day changes to tomorrow then the formula in the previous cell no longer returns a value and the conditional formatting would return teh cell colour to white. Is it possible to automate this process using VBA so that whenever the sheet is opened (daily) then it will copy and paste special the relevant stock level for that day against the correct product?

Conditional Formatting Date Cells Based On Entry In Adjacent Cell
I have a spreadsheet with 'due date' for returns in column L and 'received date' for returns, in the adjacent column M.

I would like to get the due date to turn red when it is overdue, ie. the date in the cell has arrived and no return was submitted. By trawlling the forum, I managed to accomplish this with the following in conditional formatting:
Cell value is less than or equal to =TODAY()

All's great.....but - I would like the date to turn back to black if I enter a date in the adjacent received column, column M.

In other words, I want to flag a problem if the due date has passed, but once I receive the return and enter the date I receive it, i would like the due date entry to revert back to the original formatting ie. black. So only the outstanding returns are highlighted.

Filling Combobox Based On Another Combobox.text Value.
try and achive is when a user selects a item from the 1st Combobox the 2nd Combobox is the populated with the cell that is to the right of the selected item.

for Example if a user selects AAB from combobox1,, Combobox2 should populate with Belly.

Maby using combobox1_Exit for the excercise.

Compare Date Within Date Ranges
I want to have a new macro/button to redo the chart cells based on the dates in cols T and U (abt 400 entries). T has the start date and U has the end date.

Row 9 - X9: CJ9 have dates for about 10 months (weekdays only)
Column J have either of these two values: A or B
Column C has either of these two values: C or blank

I would envisage it going through each row, checking:

If date at top of that col was between the dates in cols T & U
then
if col J = 'A' then set cell to black block
else if col J = 'B'
then
if col C = C (closed) then set cell to red block
else set cell to blue block

Formula Looking At Date Ranges?
I have start dates (column A) and maintenance expiry dates (column B). What I want to do is set up a formula to see if the product was renewed between 01/04/2007 - 31/03/2008 and return a simple yes, no or new_sales.

Examples

If the start date was 26/09/2006 and maintenance expiry date was 26/09/2008 then it would return a yes that they have renewed

If the start date was 18/04/2006 and maintenance expiry date was 18/04/2007 then it would return a no that they have not renewed

If the start date was 20/06/2008 and maintenance expiry date was 20/06/2009 then it would return a new_sale

Return A Value Between Date Ranges
I have one worksheet with 52 rows for each week of the year with the
following headings: week #, start date of week and end date of week. I have
another worksheet where I need to forecast expected expenses for new
employees based on the date they start ie. Joe starts in Feb 6 (week 6) and
then calculate expected spend based on remaining weeks in the year. I do
this manually right now. How can I automate this?

Date Ranges Intersection
There is a database with work plans for a project cycle, which contains employee names, types of activities, planned working hours for each activity (not in time format, just number) and dates when these hours will take place. Each employee may have one or multiple activities and each activity has different number of hours planned to complete and different dates. My aim is to calculate the number of hours planned for each employee (to sum all activities) within a certain period of time.

So, what is the question? I need to calculate the number of workdays within the intersection of the planned period for the activity and my given period of time.

I'll give a small example to illustrate what I mean.

I'm calculating planned working hours for this week, which is 11/23/2008-11/29/2008. One of our employees, let's call him John, is going to work on three activities, A, B, and C. We have the following plans:

Activity A - 16 hours - 11/24/2008-11/27/2008
Activity B - 45 hours - 11/15/2008-11/25/2008
Activity C - 10 hours - 11/26/2008-12/01/2008

As you can see, activity A is going to be complete within this week, it's perfectly fine. Activities B and C should be counted separately, because they include days earlier or later than this week. Is there any way I can easily geet the number of workdays that are included in the plan period and this week?

Another thing to mention is that I'm working in Excel 2003 and it's not acceptable for me to install the Tools Pack, because I need this firmula to work on other employees computers and there is no chance they all will install it too.

Using Date Ranges In Formulas ...
I am having trouble entering a formula that measures how many times "Open" occurs in one column IF another column's entry is between 2 dates or within one particular month time frame. I've tried a bunch of formulas but can't seem to get anything to work!

DSUM Date Ranges
I an having trouble with DSUM, the result I get is 0. I have a Journal Entry and I need to total the amount for a particular range date.

For the header I have:
Date|Account|Debit|Credit|Total|Account Name|Description

This is located from A5:G21

For A1:C2 I have Account|Date Start|Date End
For both Date I used the formula =">="&TEXT(E2,"mm/dd/yyyy") and the same for the ending date which is ="

COUNTIF For Date Ranges
i had some formula provided by this site which seemed to work but is now resulting in #N/A or a zero value - can you take a look?

=SUMPRODUCT(('Report X'!\$J\$6:\$J\$10000="2")*('Report X'!\$E\$6:\$E\$10000>TODAY()-30))

Report X contains 2 relevant columns... E contains the date created for each item, J contains the type of each item - in this case i wish to see how many items '2' there are in the last 30 days

Report X is a daily report copied into the same tab each day - so the data will change every day depending how long each item is still in the system

this formula does work in the example sheet i provided but not in the spreadsheet in which i need it to work!

i also have similar formulas to calculate how many items are present in between 30 and 60 days exist, and how many over 60 days - all return the value "0"

column E containing dates is in the format 01/10/2008 - changed using Ctrl F - replace to amend it from 01.10.2008

Determining Date Ranges
I have about 20 files with check posting dates stretched over several years. Maybe a million checks total. The company uses 13 four week periods each year, not a calendar month/year. I need to look up each posting date and attach the correct period to it.

I could do a VLOOKUP with one row for each day of the year, but that would require 2 x 365 row's for just two years. There must be a more elegant way, maybe using an array or some IF statement.

Attached is a sample file, xlsx, with the perior/year info and sample posting date info. Can someone point me in the right direction so that I end up with the correct period/year in column 'C' for the applicable posting date?

Average Between Date Ranges
I would like to get a monthly average between the first of the month & the end of month of a handful of percentages collected during the month for individual projects.

Copying Date Ranges To Different Worksheets
I have a file with four worksheets. The first is the master sheet. The other three sheets we can call "SheetB" "SheetC" and "SheetD." The actual names are quite long. Column T of the master sheet (except for the header row) contains dates formatted as text in YYYYMM format. I need a macro that will copy the rows to the other three sheets based on these criteria:

SheetB - dates April 2010 or before
SheetC - dates May 2010 to April 2011
SheetD - dates May 2011 and beyond

Sum For Varying Date Ranges
What I'm trying to do is sum the daily interest of a loan for any range of dates. Imagine this example:

1) In column A you have dates from 01/01/2009 through 12/31/2059, with each individual day showing, so literally thousands of cells.

2) In column B you have just random values corresponding to each date, such as \$100,000 on 01/01/2009, \$139,000 on 01/02/2009, \$52 on 01/03/2009, and so forth. These values occupy as many cells as the dates, i.e. there's a cash flow (value) for every date.

3) I want to run a formula in column C that will sum a date range I specify. For example, if I want to sum all the daily values for each month (i.e. the 1st through the 30th), or if I want to sum all the daily values for the 15th of a month through the 14th of the following month. In other words, the loan can start on any date, and I need to sum the interest for each "monthly anniversary."

4) I'm thinking that the formula will have to be different to sum an actual entire month. For example, formulas to sum from, say, the 15th of one month through the 14th of the next month, or the 10th of one month through the 9th of the next month, might be similar.

However, as there is a varying number of days in most months, that formula might not work (though I might be misunderstanding myself) when trying to sum the values for an entire month, i.e. February 1st through 28th. I think it might be solved by some sort of "if," such as if day = 1, then sum whole month, otherwise some from date through same date of next month less the last date's cash flows?

Summing Values Between A Date Ranges
I need to sum a value that falls between 2 date ranges. I have read a few posts on this subject and thought I had it working, but I realized I was getting values in fields I should not be.

=SUMPRODUCT((Details!H2:H100>=\$E\$4)*(Details!H2:H100

Formula For Totals Using Date Ranges
I need to find a formula which will give me a total of £'s between a start and end date.

MY data is an extract with names, individual dates (Ie, 01/05/08, 02/05/08, etc) and costs per day. What i want to do is show a total for the month using the start and end date of that month to add up all the costs within.

Counting Days Within Date Ranges
I run a small holiday cottage and I want to use excel to tell me which days of the year I get most enquiries for.

Every time I get an enquiry for a certain period in the cottage, I enter the dates into excel.

I have two columns - Start of holiday and End of holiday.

What I would like to do, is give each day of the year one point if someone enquires for it.

e.g. If someone asked for 3rd january to 5 january, I would give 1 point to the 3rd and 1 point to the 4th of january (but not the 5th as that is the day they would leave!)

At the moment I find it easier to count with pen and paper than use excel for this problem.

Count Dates Between 2 Date Ranges
I am trying to count the number of instances of dates that occur in a single column. For example, I want to be able to count the total # of dates that occur between Jun and July, then a different count of dates occurring between Aug and Dec (see example below). I have tried this formula: =SUMPRODUCT((E11:E149>=1/8/2008)*(E11:E149<=12/31/2009)) but it comes back with zero.

Column A
---------
1/8/2008
5/8/2008
8/18/2008
9/18/2008

Lookup Dates With Certain Date Ranges
attached worksheet.

The worksheet has two sections, Extra payments and Loan Schedule.

If a date in the Extra Payments section is within a range in Loan Schedule, the enter its corresponding value, or sum of values in the Loan schedule under its respective date.

the attached sheet explains in detail.

Count Filled Cells In One Column Based On Date In Another Column
I think I am working all around this in Excel 2003 and feel like I am in the neighborhood, but can't seem to quite get there. On sheet1 I have 2 columns of 100s of rows. All of the cells in column A will be filled in with a date as time goes by (1-May-09 for example). Several of them may be 1-May-09 as a matter of fact. In column B, some of the cells will have a number in them and some of them will be empty. On sheet2, I want to construct a formula that returns a count of cells in column B that have a number in them based on a specific date in column A. For example:

AB
1-May
1-May777
1-May
1-May
1-May
2-May999
3-May
2-May
1-May
2-May111
1-May

If I could get the formula right, it would return an answer of 1 for 1-May in the example, because only 1 of the 1-May entries in column A has a number in the adjacent cell in column B. A formula for 2-May would return an answer of 2 since only 2 of the 2-May entries in column A have numbers in the adjacent cell in column B, and so on for the month. If I understand things right, there are too many arguments for COUNTIF. It seems that SUMPRODUCT should work, but I can't make it so.

Delete Date & Time Cells Based On Time
I have a large dataset where the first column is date and time i.e. "20/01/2005 03:41:06" and I want to delete certain rows based on the times. I have already tried playing about with macro's but failed fairly spectacularly so far. I have code from someone else to delete cells if the value equals a certain time but this doesn't work as the cell contains the date too.

I have already recorded one macro to reformat the data to as the software return 10 timestamped samples per hour and I want 8 i.e. every three hours so there is constant separation for statistical purposes. Both the macros are shown below so you can see what I have.

Ideally I would like to replace the line - If (r.Cells(n, 1) = TimeValue("22:41:06")) ............ - with one that reads - If (r.Cells(n, 1) CONTAINS TimeValue........ - but I don't know if that is possible? If not is there a way to separate the time from the date into 2 columns and then I can delete rows based on the time column using the code below? .......

Count Unique Months Between Date Ranges
I'm scrambling my head to put this together. Could somebody show me how this is done?
I have two rows of data that contains dates in the mmm-yy format. The first row is the start date of the activity and the second row is the end date of the activity. Thus, in each column i would have an activity with its start and end dates. If i want to total the number of months taking into consideration only unique months (counting over-lapping months just once), how do i do that? These dates could have breaks in between, too. Like if an activity ended Jul-08, the next could begin Dec-08.
I am able to count the months using the datedif function, is there a match or other function that i need to use?