Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
768 views
in Technique[技术] by (71.8m points)

excel - Use INDEX MATCH to find greater than/equal to value

I've been searching online and in Excel Help but cannot find whether this is possible.

Given a list of numbers, values and a search term, I need to find the value whereby the value is greater than or equal to the search term. See the example:

Excel Index Match Example

Excel returns Red but it should return Orange because 15 is greater than 10.
Other desired result examples would be:

  • 5 = Red (or N/A)
  • 25 = Yellow
  • 63 = Violet
  • 15434 = Violet (or N/A)

I realise that if I sort the list in descending order and use -1 for the MATCH [match_type] argument, then it works okay, but, the list is over 1,000 rows and is far easier to read in ascending order.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your desired results appear a little inconsistent. Why is the desired result for 15 Orange but that for 63 Indigo?

Are you in fact attempting to match based on whichever corresponding value is absolutely closest to the search value, whether below or above that value?

If so:

=INDEX(B4:B10,MATCH(TRUE,INDEX(ABS(A4:A10-B1)=MIN(INDEX(ABS(A4:A10-B1),,)),,),0))

though that still won't differentiate between e.g. Orange and Yellow for a search value of 25 (though I'm not sure how you are considering 25 "closer" to 30 than 20 in any case).

Regards


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...