Find item number in database

Hi all!
I have database with 2 fields that contains list of items. One of them is a list of ranges. So it’s kind of
Field 1 - list of ranges
Field 2 - list of texts
User set up the random number and I need to find the range in Field 1 that contains that number and show the text from Field 2 which corresponds to the range. I thought I can do it by finding the item number of the range but I don’t know how to do it. Or the whole logic is wrong? I can’t preset it as an option because those ranges created by users and it could be anything.