Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2007 "Match" Function Question 2

Status
Not open for further replies.

MattGreer

Technical User
Feb 19, 2004
471
US
I have the following data:

(xVal is the array)

-20.2
100.4
122
212
302
392

When I use the function: =MATCH(142,xVal,1), it returns the value '3', just as it should. However, when I use the function =MATCH(142,xVal,-1), I get "N/A". Why does it not return 212? According to Excel, the -1 should return the position of the exact value or one higher.

I have to use this function to get the right answer =MATCH(142,xVal,1)+1. I understand it, but I don't understand why the "-1" gives me a "value not available" error.

Thank you for your help!

Thanks!!


Matt
 

hi,

If you use -1, then your list will need to be sorted in the reverse of the current order.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


FYI
ExcelHELP said:
Match_type is the number -1, 0, or 1. Match_type specifies how Microsoft Excel matches lookup_value with values in lookup_array.

If match_type is 1, MATCH finds the largest value that is less than or equal to lookup_value. Lookup_array must be placed in ascending order: ...-2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE.

If match_type is 0, MATCH finds the first value that is exactly equal to lookup_value. Lookup_array can be in any order.

If match_type is -1, MATCH finds the smallest value that is greater than or equal to lookup_value. Lookup_array must be placed in descending order: TRUE, FALSE, Z-A, ...2, 1, 0, -1, -2, ..., and so on.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top