COUNT DATES THAT ARE WITHIN 1 DAY

San Antonio Heat

Active Member
Joined
Oct 10, 2003
Messages
333
Office Version
  1. 2019
Platform
  1. Windows
Hi all,
I have dates in two columns, sheet1 A and B

On Sheet 2, I would like to count all the days that are equal to or within a day (+1)
Example Sheet 1
A1: 3/1/21 B1: 3/2/21
A2: 3/1/21 B2: 3/15/21
A3: 3/2/21 B3: 3/2/21
A4: 3/2/21 B4: 3/3/21
A5: 3/3/21 B5: 3/22/21

Sheet 2
A1 (formula) should equal 3

Thanks all.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi,

Try this:

Book3.xlsx
ABCD
13/1/20213/2/20213
23/1/20213/15/2021
33/2/20213/2/2021
43/2/20213/3/2021
53/3/20213/22/2021
Sheet854
Cell Formulas
RangeFormula
D1D1=SUMPRODUCT(--(B1:B5-1<=A1:A5))


If you may have dates in column A that is Later than corresponding column B, will need mod to formula.
 
Upvote 0
Solution
@jtakw beat me by a few minutes but I can deal with the reverse date order

=SUMPRODUCT(--(ABS(B1:B5-A1:A5)<=1))
 
Upvote 0
Hi,

Try this:

Book3.xlsx
ABCD
13/1/20213/2/20213
23/1/20213/15/2021
33/2/20213/2/2021
43/2/20213/3/2021
53/3/20213/22/2021
Sheet854
Cell Formulas
RangeFormula
D1D1=SUMPRODUCT(--(B1:B5-1<=A1:A5))


If you may have dates in column A that is Later than corresponding column B, will need mod to formula.
Thanks Jtakw, that worked like a charm.
 
Upvote 0
You're welcome, thanks for the feedback.

The double Unary ( -- ), converts TRUE, FALSE to 1 and 0

@Celly, if OP replys that there may be reverse ordered dates, then you would have already beat me to it. ;)
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,198
Members
448,554
Latest member
Gleisner2

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