Reputation: 23
When I apply an array formula for:
=count(D3:AA3)
It looks like this:
=ArrayFormula(if(row(A:A)=1,"Count",Count(D1:D:AA1:AA)))
Too many ":" (colons)?
I could (manually) paste the =count(D3:AA3)
...down every row, but I'd like it to be automated.
Upvotes: 1
Views: 569
Reputation: 5325
Here is a formula to count all the number values (COUNT
does exactly that) row-wise:
={
"Count";
MMULT(
ARRAYFORMULA(--(ISNUMBER(F2:O))),
SEQUENCE(COLUMNS(F2:O), 1, 1, 0)
)
}
You can replace F2:O
with the range you have the data in.
Update.
Count is in column A:A
, sum - column B:B
, avg - column C:C
, avg in a single cell (w/o using count and sum columns) - column D:D
. F2:N
cells have random data, some numeric, some text (will be ignored).
Here is a formula for the row wise sum of numeric values:
={
"Sum";
MMULT(
ARRAYFORMULA(IF(ISNUMBER(F2:O), F2:O, 0)),
SEQUENCE(COLUMNS(F2:O), 1, 1, 0)
)
}
Here is the formula for the row wise average if you have count and sum columns:
={
"AVG";
ARRAYFORMULA(IF(A2:A = 0, 0, B2:B / A2:A))
}
And the row wise average in a single cell w/o using count and sum columns:
={
"AVG one single formula";
ARRAYFORMULA(
IF(
MMULT(
--(ISNUMBER(F2:O)),
SEQUENCE(COLUMNS(F2:O), 1, 1, 0)
) = 0,
0,
MMULT(
IF(ISNUMBER(F2:O), F2:O, 0),
SEQUENCE(COLUMNS(F2:O), 1, 1, 0)
) / MMULT(
--(ISNUMBER(F2:O)),
SEQUENCE(COLUMNS(F2:O), 1, 1, 0)
)
)
)
}
Upvotes: 1