Forum

Notifications
Clear all

Dynamic array formula (compare cells between rows)

4 Posts
3 Users
0 Reactions
184 Views
(@austris)
Posts: 20
Eminent Member
Topic starter
 

Hi all,
It would be great if somebody could help out with writing a dynamic array formula that:

- takes a dynamic array as input

- compares each cell's value to the value right beneath it and returns true/false depending if the value matches or not

For instance, if I've got a dynamic array, i.e. I never know how many rows there will be (column count is fixed though) in A1#:

3 8 6 2
5 2 5 4
6 5 5 7

I'd like to get back also a dynamic array:

FALSE FALSE FALSE FALSE
FALSE FALSE TRUE FALSE

The trick (for me anyway) is the changing number of rows in the source array - I tried the byrow or bycolumn but once I start putting lambdas in there and passing arrays as arguments - all I get is calc error.

Anybody?

 
Posted : 23/02/2023 2:22 pm
(@debaser)
Posts: 836
Member Moderator
 

Here's one way to do it:

 

=LET(data,A1#,MAKEARRAY(ROWS(data)-1,COLUMNS(data),LAMBDA(r,c,INDEX(data,r,c)=INDEX(data,r+1,c))))

 
Posted : 25/02/2023 5:12 am
(@jnsln)
Posts: 5
Active Member
 

Another option

=DROP(A1#,-1)=DROP(A1#,1)

 
Posted : 25/02/2023 9:11 pm
(@austris)
Posts: 20
Eminent Member
Topic starter
 

Velouria - this was along the way I was trying to solve it - but failed where you did not - great!
Janset - words fail me - it's unbelievable how simple it was all along!!

Thanks you so much!!!!

 
Posted : 26/02/2023 1:28 pm
Share: