Count consecutive dates

cristinutika

New Member
Joined
Jul 21, 2020
Messages
6
Office Version
  1. 2013
  2. 2007
Platform
  1. Windows
Hello Everyone,

I would like to ask for your support regarding how can I count any consecutive dates for each employee based on Unique report number and Destination.
Basically, I want to count how many consecutive dates a employee stayed in a same location.
Is this possible to do using an excel formula?

Thank you in advance!
 

Attachments

  • Capture.PNG
    Capture.PNG
    44.4 KB · Views: 181

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Assuming that your dates are valid, try this formula in E2 and fill down

=IF(AND(A3=A2,B3=B2,C3=C2,D3=(D2+1)),"",ROW(E2)-IFERROR(MATCH(1e+100,D$1:D1),1))

If you see #VALUE! then that would mean that your dates are not in a valid format, in which case, try using find and replace (ctrl h) to change . to / in all of the dates.
 
Upvote 0
Try changing the commas to semicolons.
The first 14 dates it counted correctly but not the next ones... as the next example is related to another employee as it should be count from the beginning. Thank you in advance!
 

Attachments

  • Capture.PNG
    Capture.PNG
    66 KB · Views: 66
Upvote 0
Why did you change 1e+100 to E1+100?

That is why it is not working.
 
Upvote 0
Why did you change 1e+100 to E1+100?

That is why it is not working.
Sorry, I thought it's a mistake. Now it looks better but it does not count how many consecutive days I have (to total). Thanks!!!
 

Attachments

  • image003.jpg
    image003.jpg
    126.6 KB · Views: 104
Upvote 0
Sorry, that was a mistake that I missed. Try this one instead, hopefully I have it correct for your settings.

=IF(AND(A3=A2;B3=B2;C3=C2;D3=(D2+1));"";ROW(E2)-IFERROR(MATCH(1e+100;E$1:E1);1))

For future reference, it is preferable if you use XL2BB (green button on the reply toolbar) to post examples instead of screen captures, that way we can copy and paste it into excel and test any formulas before posting them, eliminating most errors.

A formula will not work on a screen capture, so more often than not they are posted untested.
 
Upvote 0
Sorry, that was a mistake that I missed. Try this one instead, hopefully I have it correct for your settings.

=IF(AND(A3=A2;B3=B2;C3=C2;D3=(D2+1));"";ROW(E2)-IFERROR(MATCH(1e+100;E$1:E1);1))

For future reference, it is preferable if you use XL2BB (green button on the reply toolbar) to post examples instead of screen captures, that way we can copy and paste it into excel and test any formulas before posting them, eliminating most errors.

A formula will not work on a screen capture, so more often than not they are posted untested.
It works :D Yuhuu! Thanks a lot for your support!
 
Upvote 0

Forum statistics

Threads
1,215,528
Messages
6,125,342
Members
449,218
Latest member
Excel Master

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