Home » excel » excel – Can SUMPRODUCT be used in an array formula?

excel – Can SUMPRODUCT be used in an array formula?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need to see if a number exists in a multidimensional array. LOOKUP, SEARCH, MATCH, etc. can’t do it. They either work with one-dimensional array or they require sorted array. The only thing I found is SUMPRODUCT. The following formula counts how many times the value of D1 appears in the array A1:C10.

=SUMPRODUCT(–(A1:C10=D1))

Now, if I need to find several values, e.g. D1:D5, can the above formula be modified to do what I am looking for? I tried the following but it didn’t work.

{=SUMPRODUCT(–(A1:C10=D1:D5))}

Perhaps there are other ways of doing it?

How to&Answers:

You can combine SUMPRODUCT with COUNTIF:

=SUMPRODUCT(COUNTIF(A1:C10,D1:D5))

Note that this does NOT require CTRL+SHIFT+ENTER.

Regards