Glide / Google Gods - Solve This Please

Thanks @ThinhDinh. The sample from @MegannLock does calculate the minimum value across the set of columns. It also “replicates down” as new rows are added. It’s very smart. Thanks @MegannLock.

However I have three “reservations”. Firstly, whilst it very cleverly finds the min value it doesn’t identify the specific column holding that value. Secondly, I just don’t understand it, and I am always wary of introducing functionality into my apps that I don’t fully understand. Thirdly I would have loved to achieve this 100% in Glide.

So I guess I need to learn about Google Sheets QUERY to overcome two of these at least. Awesome community guys, yet again.

1 Like

Hang on @Manan_Mehta…you’re telling me that the GDE supports MIN()?

1 Like

I haven’t achieved the column thing yet but here’s my attempt.

3 Likes

Yeah it does.

1 Like

Yes it does!

1 Like

Not sure whether to laugh or shoot myself …

1 Like

Thanks so much @MegannLock, @ThinhDinh and @Manan_Mehta for the awesome responses. Armed with this combo I can move forward. Very much appreciated. Have good days all!

1 Like

Same!! I didn’t realize that the data editor had MIN capability! :scream: my bad!

1 Like

Argh … it DOES support MIN but only for TWO parameters …

So MIN(A,B) is fine but MIN(A,B,C) is not. Time to load the revolver again.

I shouldn’t laugh, but… :rofl:

Are you open to a script solution? :grin:

1 Like

So sorry! :frowning: :tired_face:

2 Likes

Yes. At this point I’ll take anything. @MegannLock solution (and @ThinhDinh ) will work for sure. But certainly open to look at alternatives given it’s going to be Google-based anyway. Shoot (not me).

Oops. Well it can still be done in Glide. Use a nested Min function like this:
Repeat Min 8 times in your case

5 Likes

What sort of coffee are you drinking @Manan_Mehta because I want some of that stuff. Heading back to the GDE as we speak…

1 Like

:laughing:

2 Likes

Here is a script solution:

Summary
function get_header_for_min() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1');
  var row = 2;
  while (row <= sheet.getLastRow()) {
    var vals = sheet.getRange(row,2,1,9).getValues();
    var index = indexOfSmallest(vals[0]);
    var header = sheet.getRange(1,index+2).getValue();
    sheet.getRange(row,12).setValue(header);
    row++;
  }
}

function indexOfSmallest(a) {
 var lowest = 0;
 for (var i = 1; i < a.length; i++) {
  if (a[i] < a[lowest]) lowest = i;
 }
 return lowest;
}

I added this script to @MegannLock’s sheet, so you can play with it there if you want.

4 Likes

Yup. It works @Manan_Mehta . Amazing stuff. Thanks again to all in the thread. And @Darren_Murphy I will play with the script too since it’s always good to learn.

4 Likes

:joy::joy::joy:

1 Like

This community is full of amazing people I must say.

3 Likes

And some don’t even drink coffee apparently! Must be a modern thing.

2 Likes