简体   繁体   中英

Excel match function producing inconsistent results

The following questions in stackoverflow.com were read but did not help:
1. excel formula - Inconsistent behavior for INDEX(MATCH())
2. excel - Why is Application.Match() is inconsistent?
3. Unpredictable output from Excel Index-Match
4. Excel match(less than) function behaves inconsistently
5. excel - Why is Application.Match() is inconsistent?
6. worksheet function - Inconsistent formula returns in Excel

What I need is to understand and correct the cause for the inconsistent behavior of the MATCH function when using match_type 1 in different LOOKUP_ARRAY s in a spreadsheet

To clarify even further the issue I pasted below the pertinent description of match function with match_type 1 :

Match-type : 1 or omitted

Behavior: MATCH finds the largest value that is less than or equal to lookup_value . The values in the lookup_array argument must be placed in ascending order

When I perform the following:

Command                                Result
---------------------------------------------

=CORRESP(96;{0;91,2;92,8;94,4;96};1)   5                
=CORRESP(72;{0;69;70;71;72};1)         5                

The above results are correct, and I do not question them.

In the simple spreadsheet in the link I reproduce the usage of the match function =MATCH(LOOKUP_VALUE,LOOKUP_ARRAY,1) in four ranges: PVc , PV , TPDc and TPD , and with different values in several cells but the problem occurs only with LOOKUP_VALUE 72 in LOOKUP_ARRAYS TPDc and TPD .

I believe that the problem is clearly explained in the Excel file in the link.

https://1drv.ms/x/s!AlpItI7re-Sdi_NP8XD-TVxkPXVbhw

There is an issue with the values stored in your Excel sheet. If I download it and unpack (just rename *.xlsx to *.zip ), in the xl/worksheets/sheet1.xml file there is the following:

<row r="9" spans="1:26">
  <c r="A9" s="3" t="s">
    <v>8</v>
  </c>
  <c r="B9" s="5">
    <v>0</v>
  </c>
  <c r="C9" s="5">
    <v>67.833333333333314</v>
  </c>
  <c r="D9" s="5">
    <v>68.666666666666643</v>
  </c>
  <c r="E9" s="5">
    <v>69.499999999999972</v>
  </c>
  <c r="F9" s="5">
    <v>70.3333333333333</v>
  </c>
  <c r="G9" s="5">
    <v>71.166666666666629</v>
  </c>
  <c r="H9" s="5">
    <v>71.999999999999957</v>
  </c>
  <c r="I9" s="5">
    <v>71.999999999999957</v>
  </c>
  <c r="J9" s="5">
    <v>71.999999999999957</v>
  </c>
  ...
</row>

I do not know how your excel has been created, but apparently the stored numbers are not exact.

Just try to go to the cell H9 and type 7 2 Enter . The cells H10 and H11 are then re-calculated and contain the expected result.

As Antoine de Saint-Exupéry advises:

What is essential is invisible to the eye.

In other words, if you feel that Excel gives you unexpected results, always go under the hood :) You may look at another example of weird behaviour which could be solved in the same way: https://stackoverflow.com/a/49731873/2886891

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM