VBA MS excel flist of number to find if it falls between a list of numbers

S.Vella 0 Reputation points
2023-02-23T15:13:16.8066667+00:00

Hi,

I have a list of numbers as below. I have to go through all the numbers listed below

User's image

and try to see if they are between the new start and new stop and the answer would be the code

ex 447797704123000 would be E

452591880100000 - Not found

etc

User's image

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Hua-MSFT 27,796 Reputation points
    2023-02-24T06:17:47.6466667+00:00

    Hi @S.Vella

    Do you want to try a formula?

    According to your description and the sample, I make a simple sample like following image.

    Capture54

    Then please enter formula =IFERROR(INDEX($C$2:$C$6,MAX(IF(E2<IF(E2>$A$2:$A$6,$B$2:$B$6,-1),ROW($B$2:$B$6)-1,-1)),1),"Not Found") in F2.

    Press Ctrl + Shift + Enter to make this formula as an arry formula.

    Capture55


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.