Share via

Excel returns wrong data

Amin2234 226 Reputation points
2023-07-31T14:11:15.36+00:00

Hi,

I don't know why Excel returns the wrong answer when I'm using this formula:

{=COUNT(IF((C2:C21=C10)+((A2:A21=A3)*(B2:B21=B6)),F2:F21,""))}

The answer should be 6, but it's 7

Here is my Excel file to download

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments

2 answers

Sort by: Most helpful
  1. Tanay Prasad 2,260 Reputation points
    2023-08-01T05:46:08.8566667+00:00

    Hi,

    {=SUM(IF((C2:C21=C10)((A2:A21=A3)(B2:B21=B6)),1,0)*IF(F2:F21<>"",1,0))}
    

    Try using this formula once.

    Remember to enter this formula as an array formula by pressing Ctrl+Shift+Enter after typing the formula.

    Best Regards.

    Was this answer helpful?

    0 comments No comments

  2. Barry Schwarz 5,756 Reputation points
    2023-07-31T15:48:35.0266667+00:00

    The first condition in your if is nonzero 6 times: rows 10-12, 16, 19, and 21.

    The second condition is nonzero 3 times: rows 3, 13, and 20. The third condition is nonzero 4 times: rows 6, 10, 17, and 20. The product of these two conditions is nonzero once: row 20.

    The sum of these expressions is nonzero 7 times: rows 10-12, 16, 19, 20, and 21.

    Seven appears to be the correct answer for what you wrote. We might be able to help with a better formula if you described what you are trying to count.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.