Wildcards in SUMIFS formula

kbdavis11

New Member
Joined
Dec 8, 2014
Messages
30
I am attempting to use the SUMIFS formula in a spreadsheet, particularly on in-state and out of state totals. The codes for out of state will have a 3 digit number followed by a 2 letter state code followed by another two letter client code. So for example, you may see something like this:

100COAA
120COAA
100MOAA
120MOAA

There are numerous codes such as this, but the only thing I care about is the 2 letter state code. I am needing to sum all the out of state codes and in a separate total I need to sum all the in-state codes.

All the out of states are: CO, KS, MO, NM; and then the in-state doesn't use a two letter code, meaning I will need to use the not equal to '<>' for that formula.

The Sum Range is J:J
The criteria range is B:B

I attempted to use a formula such as this:

=SUMIFS(J:J,B:B,="*CO*",B:B,="*MO*"....) but evidently it doesn't like my wildcards.

then the other formula would be something like this:

=SUMIFS(J:J,B:B,<>"*CO*",B:B,<>"*MO*"....)

Any thoughts??
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Your formula isn't working because it will only SUM column J if B:B is both *CO* and *MO* ... not OR. If you want to say SUM column J if column B is like *CO* OR *MO* then try something like this:

=SUMPRODUCT((B:B="*CO*")+(B:B="*MO*")+(J:J))
 
Upvote 0
If the data extends to row 18, ctrl+shift+enter:
=SUM(J1:J18)-SUM(J1:J18*(MID(B1:B18,4,2)={"CO","KS","MO","NM"}))

Adjust the 18 as needed
 
Upvote 0
Questioner wanted NOT=. You picked out =. Changing = to <> in your formula doesn't do the job.
 
Upvote 0
Thank you all for the replies! I have tried your formulas and they all seem to do the trick just fine!


Thanks again for the assistance!
 
Upvote 0

Forum statistics

Threads
1,215,359
Messages
6,124,488
Members
449,165
Latest member
ChipDude83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top