Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

How to count a streak in Excel (Calc), with a changing range

$
0
0

I am creating a spreadsheet to track my habits through the coming year, and I want to be able to show both a simple count, and also a current streak for each habit. I've already searched and found one answer for counting a streak, but this answer does not work with a live tracker (increasing the end column by one each day), and also requires there to be no blank fields (1 or 0 entry).

=COUNTA(S$2:S$74)-MATCH(2, 1/(S2:S$74=0), 1)

If I switch the above from =0 to ="" in the match, it breaks pretty spectacularly, and in any case it fails completely for a range that includes 366 days, but the current day is <366. I would be tracking "current day" by a habit row labeled "logging" that I would populate each day, whether any other habits were logged or not. Is this something possible with formulas?

Using the suggestions I got to concat 1's and 0's to a string, I then got a successful streak formula using

=IFERROR((LEN(NG3)-SEARCH("0[^0]*$",NG3)),LEN(NG3))

Where NG is the column the concatenations exist in, and row 3 is the first row of data. I then basically duplicated my calendar to allow for non-binary logging (converting any blank or 0 entry to a 0, all other entries to a 1), and contingent on the "logged" row being populated so that unlogged days are blank fields. Works like a charm now.


Viewing all articles
Browse latest Browse all 88868

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>