Expression to find a data type with a number that falls BETWEEN numeric ranges

I have a database of my books; “Book” is a data type with a text field for “author name” and a numeric range for “hours to read,” among other fields.

I want to find a book by “Jane Smith” that takes 7 hours to read.

There are 3 Jane Smith titles in my database:

  • Book A takes 2-3 hours to read
  • Book B takes 4-6 hours to read
  • Book C takes 9-12 hours to read

I want my app to return a result that’s says: your request is between Book B and Book C, but it’s closer to Book B.

Hello @nico2023

Build logic that generates a list of numbers; then add the targetNumber, then sort it, the find the first number that is less than the target number and the first number that is greater than the targetNumber. targetNumber being 7 in your above example.

Alternatively, use AI to read this and provide you an answer.

This topic was automatically closed after 70 days. New replies are no longer allowed.