How to find the number of matched date?

G

Guest

Does anyone have any suggestions on how to find the number of matched date?
There are 2 lists of date under column A & B, and there is a given number 2
in cell C1. I would like to determine how many date under column A matched
with the date under column B within a range of error for 2 days, which is
given in cell C1.
For example,

In column A
5 Jan 2007, 8 Jan 2007, 13 Jan, 2007, 20 Jan, 2007, 26 Jan 2007, 29 Jan 2007

In column B
6 Jan 2007, 11 Jan 2007, 16 Jan, 2007, 25 Jan

The matched date under column A within a range of error for 2 days
5 Jan 2007, 8 Jan 2007, 13 Jan, 2007, 26 Jan 2007
There are 4 matched date, then return 4 in cell D1.

Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric
 
G

Guest

You can add an auxilary column that computers the difference between the 2
dates. Use absolute to make the fomula simpler. Then you can use countif to
sum the appropriate cells

Cell C1 =ABS(A1-B1)
Cell C2 = Abs(A2-B2)
Cell C3 = ABS(A3-B3)


=countif(C1:C3,"<=2")


or something a little bit more fancy for C1
=IF(ABS(B1-A1)<=2,"within 2 days","Not within 2 day")

=countif(C1:C3,"within 2 days")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top