Share via

Array Sum formula using wildcard

Anonymous
2014-03-12T10:06:24+00:00

Hi Folks

How does one use a wildcard in an array formula?

So this is the formula I'm using.

{=SUM((L2:L207=$B22)*(M2:M207=G$19))}

The values in column L are 6A, 6B, 6C, 5A etc to 3C

So B22 in the example is the reference to one of the above .

However if the value in colum L is 2A, 2B, or 2C, In an other cell I want them counted in one go because the breakdown isn't necessary.

Using =SUM(L2:L207="2*").... is not working neither is =*2?")....

:(

Thanks for any help

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
2014-03-12T15:48:51+00:00

In case more than 1 condition, then you may use

=COUNTIFS(L2:L207,"2?",M2:M207,G$19)

Thank you Vjay,

Worked perfectly.

couldn't get the ,"2?" to work with SUMPRODUCT.

Thanks for the advice on using =SUMPRODUCT for array formulas. Saves the ctrl + Shft + Entering.

Which is better =SUMPRODCUT or =COUNTIFS? (apart for the wildcard issue)

Thanks

SUMPRODUCT will not work for "2?". Would need other way to get it.

Regarding which one is better,

Then COUNTIFS is much faster than SUMPRODUCT. So in case you are able to get desired results through countifs, then you should always use countifs only, otherwise SUMPRODUCT.

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Anonymous
2014-03-12T11:26:16+00:00

First thing array formula can be avoided by using this sumproduct formula.

=SUMPRODUCT((L2:L207=$B22)*(M2:M207=G$19))

Regarding using of wild character,

If you want to use only countif then use this formula

=COUNTIF(L2:L207,"2?")

In case more than 1 condition, then you may use

=COUNTIFS(L2:L207,"2?",M2:M207,G$19)

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-03-12T15:40:12+00:00

    Hi. I'd already seen that post but couldn't apply it to my situation but thanks.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-03-12T15:39:00+00:00

    In case more than 1 condition, then you may use

    =COUNTIFS(L2:L207,"2?",M2:M207,G$19)

    Thank you Vjay,

    Worked perfectly.

    couldn't get the ,"2?" to work with SUMPRODUCT.

    Thanks for the advice on using =SUMPRODUCT for array formulas. Saves the ctrl + Shft + Entering.

    Which is better =SUMPRODCUT or =COUNTIFS? (apart for the wildcard issue)

    Thanks

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-03-12T11:18:43+00:00

    Was this answer helpful?

    0 comments No comments