Brett
Brett

Reputation: 6030

How to create a dataset from specific cells in Google Sheets

I am trying to write a formula in Google sheets that will select the 2nd highest value from a set of values. The large function works well for this for a range query dataset - e.g If I have values in A1, B1, C1 and D1, I can write the formulate as =large(a1:d1 ; 2). However, I don't want to use the full data set, I'd like to find the 2nd largest value out of A1, C1 and D1 - how can I create a dataset from a specific list of cells (I've tried a comma-seperated list and & and been trying to find something in the Google Drive docs, but not finding a valid way).

Upvotes: 0

Views: 1492

Answers (2)

ttarchala
ttarchala

Reputation: 4567

Why not simply

=large({A1, C1, D1}, 2)

Some docs about constructing arbitrary arrays is here: https://support.google.com/docs/answer/6208276?hl=en

Upvotes: 1

Brett
Brett

Reputation: 6030

Am able to do this using query - select the columns with query to create the new dataset and then pass to large.

=large(query(A1:D1, "select A,B,D") ; 2)

Upvotes: 0

Related Questions