How to calculate number of non-rest days YTD current year and last year?

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
I have kept a personal exercise log for many years and I am trying to keep myself motivated (extract below).

Column A12 contains consecutive dates exercised from 01.01.1999, and a row is added to this for every new day.

Column B12 contains exercise activity.


Mon, 8 Oct 2018 OTHER
Tue, 9 Oct 2018 OTHER
Wed, 10 Oct 2018 REST
Thu, 11 Oct 2018 REST
Fri, 12 Oct 2018 REST
Sat, 13 Oct 2018 REST
Sun, 14 Oct 2018 OTHER
Mon, 15 Oct 2018 REST
Tue, 16 Oct 2018 Viaduct
Wed, 17 Oct 2018 OTHER
Thu, 18 Oct 2018 OTHER
Fri, 19 Oct 2018 Viaduct
Sat, 20 Oct 2018 OTHER
Sun, 21 Oct 2018 OTHER
Mon, 22 Oct 2018 Viaduct
Tue, 23 Oct 2018 OTHER
Wed, 24 Oct 2018 OTHER
Thu, 25 Oct 2018 Viaduct
Fri, 26 Oct 2018 OTHER
Sat, 27 Oct 2018 OTHER
Sun, 28 Oct 2018 OTHER
Mon, 29 Oct 2018 OTHER
Tue, 30 Oct 2018 OTHER


What I'm looking for is 2 formulas that

1) Count the number of cells that do NOT contain the word REST from Jan 1 in the current year to date (e.g. to Oct 30 2018)

2) Count the number of cells that do NOT contain the word REST from Jan 1 in the previous year to date (e.g. to Oct 30 2017)

Thank you ever so much!
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
On mobile so won't have whole code but in VBA you can loop through them and keep a count of how many times this holds true for if statements:
If instr(cell.value, "REST") = 0 and instr(cell.value, "2018") > 0 Then
...

If instr(cell.value, "REST") = 0 and instr(cell.value, "2017") > 0 Then
...
 
Upvote 0
Thanks RileyC but I'm just a noob and I don't know VBA.

If it helps you or anybody else, Jan 1 2017 is A6063 and Jan 1 2018 is A6428 but of course the difference won't always be 365 days due to leap years.

Thanks again.
 
Upvote 0
This year:

=COUNTIFS(A:A, ">=1/1/18", A:A, "<=" & TODAY(),B:B, "<>REST")

Last Year:

=COUNTIFS(A:A, ">=1/1/17", A:A, "<=" & EDATE(TODAY(), -12), B:B, "<>REST")
 
Last edited:
Upvote 0
Thank you so much for your time shg, that works perfectly :)
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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