Share via

Array formula error with VLOOKUP

Anonymous
2010-04-13T23:28:29+00:00

Hi,

I have encountered an error with an array function that I can't explain.  Basically, the formula that gives the wrong answer is:

=Sum(if(a2:a10=1,1,0)*vlookup(b2:b10, sheet!a1:c3, 3, false))

What seems to be happening is that I get the sum of the IF function and the array that the IF function returns is not multiplied by the array that the VLOOKUP function returns.

If instead of putting this into a single cell I have a column that has the IF array, a column that has the VLOOKUP array, a column that has the product of the two, and a cell that sums the product I get the correct answer.

So, why doesn't it all work in one cell?

Eric

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-04-25T17:00:54+00:00

Your formula, as written, will not return the results you want.

Try this:

=SUMPRODUCT((A2:A10=1)*SUMIF(Sheet1!A1:A3,Sheet2!B2:B10,Sheet1!C1:C3))

I used Sheet1, assuming you don't actually have a sheet named "sheet".

Is that something you can work with?


Ron Coderre

Microsoft MVP - Excel (2006 - 2010)

P.S. If any post answers your question, please mark it as the Answer (so it won't keep showing as an open item.)

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-05-02T21:13:19+00:00

    Hi Ron,

    Thanks.  That's the concept that I eventually went with.  Vlookup worked on a single line, and I was hoping that it would work for an array, but I guess not. 

    Thanks again,

    Eric

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-04-25T16:38:01+00:00

    Had done that already.  Doesn't help.  Thanks, but try again.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-04-14T13:38:13+00:00

    To use an array formula, press CTRL+SHIFT+ENTER after entering the formula to get the desired result.

    Refer the links given below for additional information on using array formula in Excel:

    http://office.microsoft.com/en-us/excel/HP051983191033.aspx

    http://office.microsoft.com/en-us/excel/HP052000201033.aspx

    http://office.microsoft.com/en-us/excel/HP051999601033.aspx

    Was this answer helpful?

    0 comments No comments