Forum Discussion

Jon Cohen's avatar
Jon Cohen
Copper Contributor
Nov 14, 2018

"Close enough" MATCH

I run a business using a big honkin' complex Excel worksheet.  I've installed several checks to make sure I've entered data correctly.   I get a moderate number of reports from various sources, eac...
  • SergeiBaklan's avatar
    SergeiBaklan
    Nov 15, 2018

    Jon, for better understanding how the formula works you may stay on the cell with formula (any one) and on ribbon Formulas->Evaluate Formula to see step by step what formula calculates.

     

    Alternatively in formula bar you may select part of the formula which performs this or that calculation, F9 to see result of it and Ctrl+Z to return back.

     

    As for you questions

    1) Yes, arithmetic operation of single value and array performs that operation on each element of the array. You may try =SUM({2,3}+2), it returns 9 and intermediate calculation is =SUM({4,5}). Check with evaluate. Thus yes, that part of the formula returns an array like

    {abs(a1-b1), abs(a1-b2)abs(a1-b3)abs(a1-b4)}

     

    2) Correct, that will be an array with TRUE and FALSE

     

    3) Double dash transform logical value to its numeric equivalent.

    =--TRUE returns 1 (as well as =TRUE*1 and =TRUE+0)

    =--FALSE returns 0, similar to above

     

    4) If you need position, not the value on that position, as Detlef mentioned just don't use outer INDEX

    =MATCH(1,INDEX(--(ABS(A1-B1:B4)<=0.05),0,),0)

    In addition, inner INDEX here allows to avoid using of array formula, it returns resulting after ABS calculations array directly to MATCH. Alternatively you may use array formula (Ctrl+Shift+Enter)

    =MATCH(1,--(ABS(A1-B1:B4)<=0.05),0)

    which returns the same result:

Resources