Reputation: 49
I have a row of names of restaurants in Google Sheets, but I only want to countunique() the last n cells in the column without having to constantly update the range of the function manually. This is all being done on a pivot table as well.
E.g.:
n = 5
Raw Data
Pivot Table
Upvotes: 0
Views: 91
Reputation: 1
try:
=QUERY(QUERY(A:A,
"offset "&COUNTA(A:A)-B1),
"select Col1,count(Col1)
where Col1 is not null
group by Col1
label count(Col1)''")
or:
=ARRAYFORMULA(QUERY({UNIQUE(A:A),
IFNA(VLOOKUP(UNIQUE(A:A), QUERY(QUERY(A:A,
"offset "&COUNTA(A:A)-B1),
"select Col1,count(Col1)
where Col1 is not null
group by Col1
label count(Col1)''"), 2, 0))*1},
"where Col1 is not null"))
Upvotes: 1