Hey @Manan_Mehta, @Jeff_Hager, @Robert_Petitto, I keep meaning to come back to this and show you what I did for streak mechanic. Warning, it’s not pretty. It’s calculation intensive and it relies on .gs to write these formulas into each new record added to the sheet:
Okay, so I have a content sheet. I have a date field, a creator field, and a streak field (among other fields of course, but these are the only ones relevant). In the streak field I have this formula:
=IFERROR(IF(ROW()<>COUNTA(A$1:A)+1,DATEDIF(TO_DATE(INT(VLOOKUP(INDIRECT(“E$”&ROW()),INDIRECT(“E$”&ROW()&":BS"),67,0))+0.9999999999),TO_DATE(INT(VLOOKUP(INDIRECT(“E$”&ROW()),INDIRECT(“E$”&ROW()+1&":BS"),67,0))+0.9999999999),“d”),1),IF(NOW()-TO_DATE(INT(VLOOKUP(INDIRECT(“E$”&ROW()),INDIRECT(“E$”&ROW()&":BS"),67,0))+0.9999999999)>1,2,1))
In a nutshell, this formula checks how many days between the current submission and the next one by the creator of that piece of content. It does so, by subtracting the last second of the current day of the submission from the last second of the next day that same user submits. That means if they submit on the same day, the result will be zero, and if they submit at any time the next day, it will be one (accumulating with each day away from that). I use Row() and Row()+1 to do two separate vlookups, the second of which excludes the current record from the search, and finds the next record instead. I have a few conditions to account for when it’s the last record in the sheet (in which case it will either be 1 or 2—the latter essentially substituting for however long past 1 day it’s been).
Then in the User’s sheet, I have this formula being manually written in for each user:
=IFNA(MATCH(TRUE,INDEX(1/ARRAYFORMULA(RIGHT(SORT(ARRAYFORMULA(FILTER(Lor!A$3:A, Lor!E$3:E = INDIRECT(“C”&ROW()), Lor!CA$3:CA <> 0)&"-"&FILTER(Lor!CA$3:CA, Lor!E$3:E = INDIRECT(“C”&ROW()), Lor!CA$3:CA <> 0)),1,0),LEN(SORT(ARRAYFORMULA(FILTER(Lor!A$3:A, Lor!E$3:E = INDIRECT(“C”&ROW()), Lor!CA$3:CA <> 0)&"-"&FILTER(Lor!CA$3:CA, Lor!E$3:E = INDIRECT(“C”&ROW()), Lor!CA$3:CA <> 0)),1,0))-FIND("-",SORT(ARRAYFORMULA(FILTER(Lor!A$3:A, Lor!E$3:E = INDIRECT(“C”&ROW()), Lor!CA$3:CA <> 0)&"-"&FILTER(Lor!CA$3:CA, Lor!E$3:E = INDIRECT(“C”&ROW()), Lor!CA$3:CA <> 0)),1,0))))<>1),0)-1,0)
In a nutshell, this filters that previous column from the first content sheet by the user of this row, it flips the whole filtered row (I had to actually ad add ID numbers to the data in each row so that SORT could reverse order the values. Then I do a count of every number 1 from that row (all pieces of content that are one day apart from the next) until I hit a value greater than 1, in which case I stop the count.
I know… it’s nasty looking. But it works. How many record before my sheet starts lagging from these two formulas? That I can’t say.