Forum Discussion
BYCOL & BYROW
- Jul 06, 2024=MAP(C3#&B4#,LAMBDA(A,COUNTA(UNIQUE(FILTER(K3:K25,(J3:J25&I3:I25=A))))))
This is the perfect solution by
Julian Poeltl
https://www.linkedin.com/in/julian-p%C3%B6ltl/
=MAKEARRAY(5,4,LAMBDA(r,c,COUNTA(UNIQUE(FILTER(K3:K25,(I3:I25=INDEX(B4:B8,r))*(J3:J25=INDEX(C3:F3,c)))))))
Try the MAKEARRAY formula which returns the intended result in my file.
- anshul_mareleJun 28, 2024Copper Contributor
Very thanks OliverScheurich
But why to complicate a simple logic, if it is possible in Google Sheets then would also possible in Excel.- PeterBartholomew1Jul 27, 2024Silver Contributor
"But why to complicate a simple logic, if it is possible in Google Sheets then would also possible in Excel"
That is not the way it works. Excel and Sheets are competitor products and each company is free to make its own decisions. Personally, I agree with you in that Microsoft was guilty of a massive error of judgement when they decided, for backward compatibility reasons, that arrays of arrays were not supported.
The array of array problem affects most of the formulas I write, frequently at more than one point within the code. I have versions of the Lambda helper functions that provide workarounds, using thunks to hold the inner nested arrays, but I resent the need for this.
In the present instance, there would appear to be solutions that broadcast without the need for such complexity.
= COUNTIFS(lookup1,distinct1,lookup2,distinct2) "where" distinct1 = UNIQUE(lookup1) distinct2 = TOROW(UNIQUE(lookup2))
or, using the insider beta version of Excel
= PIVOTBY(lookup1, lookup2, data, COUNTA,,0,,0)
- anshul_mareleJul 28, 2024Copper Contributor
PeterBartholomew1 thanks
but can you please rewrite the 1st formula with actual cell ranges
- SergeiBaklanJun 28, 2024MVP
So far Excel doesn't support nested arrays natively. Google Sheets supports.
As a comment, you use formula like IFERROR( COUNTA( UNIQUE(...
If UNIQUE returns an error, COUNTA gives 1. It counts all values, includes errors. Thus IFERROR never works here.
As variant that could be IFERROR( ROWS( UNIQUE(... which with gives 0 in case of error.
- anshul_mareleJul 06, 2024Copper Contributor=MAP(C3#&B4#,LAMBDA(A,COUNTA(UNIQUE(FILTER(K3:K25,(J3:J25&I3:I25=A))))))
This is the perfect solution by
Julian Poeltl
https://www.linkedin.com/in/julian-p%C3%B6ltl/