Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why am I getting this ARRAY_LITERAL when combining QUERY + LAMBDA in Google Sheets?

Trying to apply this answer to the dataset below so as to have the latest entries returned, but I keep getting: In ARRAY_LITERAL, an Array Literal was missing values for one or more rows. and I can’t find out why:

Here is the formula: =filter({unique(B2:B);byrow(unique(B2:B),LAMBDA(each,query(B:H,"select * where B matches "&each&" order by H Desc limit 1", 0)))},unique(B2:B)<>"")

Here is the dataset in a file.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Why would this show Formula parse error?
enter image description here

I’d appreciate your help!

>Solution :

It looks like the error message you are getting is due to a syntax error in your formula. In particular, the error occurs because you are using the LAMBDA function inside the byrow function, but you are not providing the correct number of arguments to the LAMBDA function.

To fix this error, you can update your formula as follows:

Use the LAMBDA function to define a named function that takes one argument (each).
Inside the LAMBDA function, use the query function to retrieve the latest entries from the B:H range that match the value of each.
Use the filter function to filter the unique values in the B2:B range, and use the byrow function to apply the named function (defined using LAMBDA) to each value in the B2:B range.
Here is an example of how your formula could look after making these changes:

=filter({unique(B2:B);byrow(unique(B2:B),LAMBDA(each, query(B:H,"select * where B matches "&each&" order by H Desc limit 1", 0)))}, unique(B2:B)<>"")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading