Small amendment to formula that calculates number of cells since certain word appears in cell

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

The below Cells A8623:B8631 are a small extract from Cells A12:B35795

The below formula returns the number of days' consecutive activity since the last cell with REST in Column B.

Excel Formula:
=MAX(A12:A35795)-AGGREGATE(14,6,A12:A35795/(B12:B35795="REST"),1) & " DAY EXERCISE STREAK"

In the below example the result is 4, which the above formula returns (in Cell A8)
4 DAY EXERCISE STREAK


What I'm looking for is an addition to the above formula (or an alternative formula that does the job) so if the result is either 0 or 1 then the result cell A8 shows the word EXERCISE instead of "0/1 DAY EXERCISE STREAK".

Many thanks!

Fri, 30 Jul 2021REST
Sat, 31 Jul 2021OTHER
Sun, 1 Aug 2021Cullingworth Rd/Viaduct/ Stn Road/Old Allen Road Back Lane/Wilsden Rd/ Cottingley Rd/Lee Lane/ Cross Lane/Coplowe Ln/ Crack Lane/Main Street/ Harden Ln/Mill Hill Top/ Wilsden Rd/Mad Mile/ Greenside Lane (21/02/2020)
Mon, 2 Aug 2021OTHER
Tue, 3 Aug 2021REST
Wed, 4 Aug 2021OTHER
Thu, 5 Aug 2021Hallas Br/Down Bents Ln Harden Lane/Smithy Ln/ Lee Farm/Black Hills/ Golf Course/R down Beck Foot Lane/Wagon Lane/ Up LLC to cannon monument/Back to 3-Rise Locks & over Br/ Brown Cow/Main Road all the way back home (22/04/2007)
Fri, 6 Aug 2021OTHER
Sat, 7 Aug 2021OTHER
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try
Excel Formula:
=IF(MAX(A12:A35795)-AGGREGATE(14,6,A12:A35795/(B12:B35795="REST"),1)<2,"EXERCISE",MAX(A12:A35795)-AGGREGATE(14,6,A12:A35795/(B12:B35795="REST"),1)& " DAY EXERCISE STREAK")
 
Upvote 0
Solution
That's perfect Peter, thank you so much!

I bet you thought "that's an elegant formula" so you won't be surprised that it was your good self who provided it in Oct 2018 :)
 
Upvote 0
You're welcome.

... no, I didn't recognise the formula but I'm glad it is still being of use. :biggrin:
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

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