Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Match function not working match_type

0

I am using a Match function:

=MATCH(15,A1:A3,0)

This works just fine with the match_type argument at 0 and it works well when I change it to 1 in order to get the next value that is below the lookup value (when there is no exact match).

But, when I input -1 for the match_type to get the next highest value when there is no match I just get a #N/A error.

I'm dying trying to figure this out and I know it must be simple, can anyone help?

Answer
Discuss

Answers

0
Selected Answer

When you use -1 for the match_type, the numbers need to be sorted in DESCENDING order; so it must go from high to low.

If you want to get the next highest value if there is no match, sort the data in descending order.

If you want to get the next lowest value if there is no match, sort the data in ascending order.

Discuss

Discussion

ahh stupid me, thank you!
yolagreen Jun 30, '16 at 12:07 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login