MATCH function not finding exact match

%3CLINGO-SUB%20id%3D%22lingo-sub-1585616%22%20slang%3D%22en-US%22%3EMATCH%20function%20not%20finding%20exact%20match%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1585616%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20initially%20began%20this%20conversation%20with%20a%20problem%2C%20but%2C%20as%20I%20was%20writing%2C%20I%20was%20able%20to%20fix%20my%20issue.%20So%2C%20seeing%20I%20had%20already%20written%20most%20of%20it%2C%20I%20though%20I%20would%20include%20my%20findings%20in%20case%20anyone%20else%20has%20a%20similar%20issue.%20Note%2C%20I%20fixed%20my%20issue%2C%20but%20I'm%20not%20certain%20I%20understand%20what%20was%20causing%20the%20problem.%20Perhaps%20someone%20else%20can%20elaborate%20on%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EMy%20issue...%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20MATCH%20function%20is%20not%20returning%20the%20correct%20value%20even%20though%20the%20exact%20match%20is%20clearly%20in%20the%20list.%20Instead%2C%20it%20returns%20the%20smallest%20value%20that%20is%20greater%20than%20the%20lookup%20value%20(option%20-1).%20Of%20those%20that%20I've%20tried%2C%20It%20only%20seems%20to%20occur%20with%20one%20specific%20lookup%20value%20(50).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20thought%20it%20may%20be%20an%20issue%20with%20my%20main%20spreadsheet%20as%20it's%20pretty%20involved%20and%20relatively%20large.%20So%2C%20I%20copied%20the%20raw%20date%20for%20one%20column%20while%20maintaining%20the%20find%20value%2C%20search%20array%2C%20and%20return%20array.%26nbsp%3BSame%20result.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20included%20image%20illustrates%20the%20issue.%20The%20spreadsheet%20is%20also%20attached.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22knov_ga_0-1597271829402.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212129iF52E95C55447B9B3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22knov_ga_0-1597271829402.png%22%20alt%3D%22knov_ga_0-1597271829402.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(1)%20With%20a%20lookup%20value%20of%2050%2C%20the%20expected%20result%20in%20cell%20I1%20is%20%2259%2F1.18%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%222020-08-12%2018_19_08-Greenshot%20image%20editor.png%22%20style%3D%22width%3A%20246px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212132i96D8B4F1208FD04C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222020-08-12%2018_19_08-Greenshot%20image%20editor.png%22%20alt%3D%22Item%20(1)%20-%20Lookup%20Value%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EItem%20(1)%20-%20Lookup%20Value%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(2)%20However%2C%20the%20result%20is%20%2259%2F1.15%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%222020-08-12%2018_21_51-Greenshot%20image%20editor.png%22%20style%3D%22width%3A%20149px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212133iF69E32210C53838F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222020-08-12%2018_21_51-Greenshot%20image%20editor.png%22%20alt%3D%22Item%20(2)%20-%20Incorrect%20Return%20Value%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EItem%20(2)%20-%20Incorrect%20Return%20Value%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(3)%20Evaluating%20the%20formula%2C%20you%20can%20see%20that%20the%20MATCH%20function%20is%20return%20an%20offset%20of%20'7'.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222020-08-12%2018_22_53-Greenshot%20image%20editor.png%22%20style%3D%22width%3A%2093px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212134i1C2154A77F04F5D5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222020-08-12%2018_22_53-Greenshot%20image%20editor.png%22%20alt%3D%22Item%20(3)%20-%20Wrong%20Offset%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EItem%20(3)%20-%20Wrong%20Offset%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(4)%20The%20incorrect%20offset%20is%20then%20passed%20to%20INDEX%20where%20the%20wrong%20value%20%221.15%22%20is%20returned.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222020-08-12%2018_24_40-Greenshot%20image%20editor.png%22%20style%3D%22width%3A%20127px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212137i22B0292ACF1C2DCA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222020-08-12%2018_24_40-Greenshot%20image%20editor.png%22%20alt%3D%22Item%20(4)%20-%20Wrong%20Return%20Value%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EItem%20(4)%20-%20Wrong%20Return%20Value%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(5)%20It's%20clear%20to%20see%20that%20an%20exact%20match%20of%2050%20does%20exist.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222020-08-12%2018_24_57-Greenshot%20image%20editor.png%22%20style%3D%22width%3A%20113px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212136i36782D2054E2B0DA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222020-08-12%2018_24_57-Greenshot%20image%20editor.png%22%20alt%3D%22Item%20(5)%20-%20Match%20clearly%20present%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EItem%20(5)%20-%20Match%20clearly%20present%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20same%20issue%20exists%20in%20cell%20I2.%20Here%20it's%20calculating%20ratio%20from%20return%20value%20to%20lookup%20value.%20Again%2C%20it's%20returning%20one%20offset%20less%20than%20it%20should%2C%20resulting%20in%20an%20incorrect%20calculation.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20add%2C%20it%20could%20be%20a%20data%20type%20issue%20or%20something.%20If%20I%20remove%20the%20formula%20from%20cell%20I15%20and%20replace%20it%20with%20the%20value%2050%2C%20the%20MATCH%20function%20returns%20the%20correct%20result.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdditionally%2C%20if%20I%20round%20the%20calculated%20result%20in%20cell%20I15%2C%20the%20MATCH%20function%20works.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EMy%20resolution...%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20my%20application%2C%20many%20of%20my%20calculations%20were%20included%20to%20simply%20eliminate%20manual%20entry%20of%20static%20values.%20You'll%20note%20column%20'G'%20has%20calculated%20data%20from%20row%20'8'%20to%20row%20'200'.%20If%20I%20remove%20all%20of%20the%20calculations%20and%20simply%20replace%20all%20the%20data%20in%20column%20'G'%20with%20static%20values%2C%20it%20all%20works.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20somewhere%20deep%20in%20Excel%2C%20there%20must%20have%20been%20some%20calculation%20that%20didn't%20end%20in%20an%20exact%20result.%20This%20error%20then%20propagated%20up%20to%20the%20MATCH%20function.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1585616%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1585704%22%20slang%3D%22en-US%22%3ERe%3A%20MATCH%20function%20not%20finding%20exact%20match%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1585704%22%20slang%3D%22en-US%22%3EProbably%20a%20rounding%20error%20related%20to%20floating%20point%20math.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fmicrosoft-365%2Fblog%2F2008%2F04%2F10%2Funderstanding-floating-point-precision-aka-why-does-excel-give-me-seemingly-wrong-answers%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fmicrosoft-365%2Fblog%2F2008%2F04%2F10%2Funderstanding-floating-point-precision-aka-why-does-excel-give-me-seemingly-wrong-answers%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20use%20the%20Round%20function%20for%20your%20calculations%20in%20column%20I%20(round%20to%20a%20level%20of%20precision%20appropriate%20for%20your%20needs)%2C%20then%20I%20believe%20you%20will%20get%20the%20answer%20you%20expect.%20I%20rounded%20to%2020%20decimal%20places%20and%20it%20matched%20to%201.18.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1586421%22%20slang%3D%22en-US%22%3ERe%3A%20MATCH%20function%20not%20finding%20exact%20match%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1586421%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EInteresting%20case.%20It%20looks%20like%20MATCH%20internally%20also%20takes%20into%20account%2017%20digits%20as%20some%20other%20functions%20(e.g.%20RANK).%20ROUND%20returns%2015.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20775px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212196iCB32AD536DA3A6CA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

 

 

I initially began this conversation with a problem, but, as I was writing, I was able to fix my issue. So, seeing I had already written most of it, I though I would include my findings in case anyone else has a similar issue. Note, I fixed my issue, but I'm not certain I understand what was causing the problem. Perhaps someone else can elaborate on that.

 

My issue...

 

The MATCH function is not returning the correct value even though the exact match is clearly in the list. Instead, it returns the smallest value that is greater than the lookup value (option -1). Of those that I've tried, It only seems to occur with one specific lookup value (50).

 

I thought it may be an issue with my main spreadsheet as it's pretty involved and relatively large. So, I copied the raw date for one column while maintaining the find value, search array, and return array. Same result.

 

The included image illustrates the issue. The spreadsheet is also attached.

 

knov_ga_0-1597271829402.png

 

(1) With a lookup value of 50, the expected result in cell I1 is "59/1.18".

 

Item (1) - Lookup ValueItem (1) - Lookup Value

 

 

(2) However, the result is "59/1.15".

 

Item (2) - Incorrect Return ValueItem (2) - Incorrect Return Value

 

 

(3) Evaluating the formula, you can see that the MATCH function is return an offset of '7'.

 

Item (3) - Wrong OffsetItem (3) - Wrong Offset

 

(4) The incorrect offset is then passed to INDEX where the wrong value "1.15" is returned.

 

Item (4) - Wrong Return ValueItem (4) - Wrong Return Value

 

(5) It's clear to see that an exact match of 50 does exist.

 

Item (5) - Match clearly presentItem (5) - Match clearly present

 

The same issue exists in cell I2. Here it's calculating ratio from return value to lookup value. Again, it's returning one offset less than it should, resulting in an incorrect calculation.

 

I will add, it could be a data type issue or something. If I remove the formula from cell I15 and replace it with the value 50, the MATCH function returns the correct result.

 

Additionally, if I round the calculated result in cell I15, the MATCH function works.

 

My resolution...

 

For my application, many of my calculations were included to simply eliminate manual entry of static values. You'll note column 'G' has calculated data from row '8' to row '200'. If I remove all of the calculations and simply replace all the data in column 'G' with static values, it all works. 

 

So, somewhere deep in Excel, there must have been some calculation that didn't end in an exact result. This error then propagated up to the MATCH function.

 

2 Replies
Highlighted
Probably a rounding error related to floating point math.

https://www.microsoft.com/en-us/microsoft-365/blog/2008/04/10/understanding-floating-point-precision...

If you use the Round function for your calculations in column I (round to a level of precision appropriate for your needs), then I believe you will get the answer you expect. I rounded to 20 decimal places and it matched to 1.18.
Highlighted

@JMB17 

Interesting case. It looks like MATCH internally also takes into account 17 digits as some other functions (e.g. RANK). ROUND returns 15.

image.png