Calculate a list, with the difference between 2 values, and obtain the minimum value of the list

Hello, I would like to ask for your help with the following: I have a “Calibers” table with two columns, one with the name and another with a decimal value called “Thickness”. What I need is from another table to calculate, given a value, the difference between that value and the “Thickness” column, and find the minimum value of that difference to determine which caliber it is closest to.

i did it in excel, but i don’t know how to migrate to appsheet.

Please, help!!!

I believe you can use the ORDERBY() and INDEX() functions.

Something like this:

INDEX(
ORDERBY(
Calibers[Row ID],
ABS([_THISROW].[Entered Thickness] - [Thickness])),

1

)

NOTE: I have not tested this expression out and I have not implemented such an expresion before.

The ABS() function gives you the absolute value of the subtraction. ORDERBY() should sort the rows in ascending order by resulting absolute difference. Index picks off the FIRST row - the Calibers row with the smallest difference to the entered thickness.

I hope this helps!

3 Likes

it works perfect!!!

thank you very much!!!

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.