Forum Discussion

rossshah's avatar
rossshah
Brass Contributor
Mar 19, 2026
Solved

Sumif inside Xlookup

Can someone tell me how to sum within Xlookup please?   Correct answer above would have been 65+5=70.   I am looking for total qty, if part is "F" and Location is "OM".   Main Table has two matches.   My current Xlookup formula only selects one record.    This Xlookup formulas only  works for one unique record.  Thank you in advance.

  • Thank you.  Sumproduct did not work but filter function formula above worked.   Thanks again.  

7 Replies

  • rossshah's avatar
    rossshah
    Brass Contributor

    Thank you.  Sumproduct did not work but filter function formula above worked.   Thanks again.  

    • m_tarler's avatar
      m_tarler
      Bronze Contributor

      So I just checked and realize the error on the SUMPRODUCT is that the "numeric" range (C:C) has the "Total" line.  This would have worked better if it was a Table but making the range actually where the data is would fix it or a simple IFERROR would also correct it:

      =SUMPRODUCT((A2:.A99=$E$2)*(B2:.B99=E6)*(C2:.C99))

      or

      =SUMPRODUCT( IFERROR((A:A=$E$2)*(B:B=E6)*(C:C),0 ))

      and honestly you can just use SUM and do both (range where the data is and iferror just in case there is a bad value in the range)

      =SUM( IFERROR((A2:.A99=$E$2)*(B2:.B99=E6)*(C2:.C99),0 ))

      the use of SUMPRODUCT dates back to before Excel added dynamic arrays and SUMPRODUCT was a way to easily do array calculations without the ctrl-shift-enter.

      Either way, I'm glad it is working for you now and how you also learned some more techniques that will be helpful for you as you use Excel.  Please mark the appropriate comment that actually provides a solution (you can use the 3 dots to change it as needed)

  • m_tarler's avatar
    m_tarler
    Bronze Contributor

    I suggest you just use FILTER or SUMPRODUCT instead.  Here are a couple examples that should work:

    =SUM(FILTER(C:C, (A:A=$E$2)*(B:B=E6), 0) )

    =SUMPRODUCT( (A:A=$E$2)*(B:B=E6)*(C:C) )

    • rossshah's avatar
      rossshah
      Brass Contributor

      Thank you for helping me.  All three formulas worked except for the one with additional "." in front.   

      Following formula is the one that did not work.     

      =SUMPRODUCT( A2:.A99=$E$2)*(B2:.B99=E6)*(C2:.C99)) 

      But I have three formulas returning the correct value.      Thanks again.      

      • m_tarler's avatar
        m_tarler
        Bronze Contributor

        you're welcome.  Somehow I dropped a ( it should be:

        =SUMPRODUCT( (A2:.A99=$E$2)*(B2:.B99=E6)*(C2:.C99)) 

        I corrected it in the message below also