I have a sheet with a Date
and a Days
heading and other non-relevant columns with more information.
Each Date
only specifies the day and does not go into further precision like hours, minutes, or seconds. A day often occurs on multiple rows.
The Days
column should indicate the number of unique days represented from the first entry in row 2
.
I want to solve it by using an ARRAYFORMULA in the Days
header (or some other logic, which is contained solely in the Days
header) to fill that column, as I find it more elegant than a repeating formula in each cell.
I have tried several ways to use ARRAYFORMULA, for example, by using INDIRECT on a text representation of the Date
range and then using UNIQUE and COUNTA on that. But without success.
The closest I've come without the solution breaking is getting the text representation of the relevant Date
range into each cell.
I did that with the following:
={"Days";ARRAYFORMULA(("A2:A" & ROW(A2:A)))}
In the meantime, I've solved this using a repeating formula:
=IF(ISBLANK(A2),"",IFERROR(IF(A2<>A1,1,0)+B1,1))
But I'd much rather keep my "logic" in the header cell and have pure data in the table. I don't know if it is possible, though!
I am looking for an answer which either:
- Solves it in a way that only has the logic in the Days header cell (could be using
ARRAYFORMULA
or some other way). - Explains why it's impossible.
Example sheet containing all the above: Google Sheet link