Excel Formula Help: Number Matching

bawrites

New Member
Joined
Mar 28, 2017
Messages
2
I'm having difficulty getting my head around how to fix this and am hoping someone will have a solution to my dilemma.

I have a column on my source data sheet that contains data like "Reg 1, Reg 2, Reg 3, Reg 4.. Reg13, Reg14, Reg03, Reg04, etc..."

I'm attempting to break out the number of occurrences for each Reg number and summarize to a table similar to what you see below.

Store #Reg #Count
2431
41
56
6

<colgroup><col span="3"></colgroup><tbody>
</tbody>

The issue I'm running into is that I used a wildcard to match the type in the register source data column, and its matching not only the "3" for 3, it's also matching the "3" and counting it in "13" and "23".

=COUNTIFS(Data!N:N,$W$5,Data!D:D,"*3*",Data!M:M,">"&$T$4)

Data!N:N is a column containing the store number, and $W$5 is a manually entered store number field.
Data!D:D is the register source data column, with, in this case, *3* being my wildcard.
Data!M:M is a date column, and the cell $T$4 is a date field.

Is there an easy way for me to match *only* cells that contain 3 or 03 but not 13, and 23 - for instance?

The real headache of this is that the source data is inconsistent.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Your inconsistent data really complicates things. I would recommend that you make a consistent data column, which it appears you can do by simply substituting a 0 for all the spaces in your data, converting Reg 1 to Reg 01, and allowing you to sum the 01, 02, etc. But if your numbers get bigger than 99 or if you have other places where you have spaces, eg. trailing spaces, that won't work.

If the only text in your data column is, as in your sample data, Reg, you could strip out the Reg and any spaces, then do your counts on numbers.

Good luck

Ken
 
Upvote 0
You can try

=SUM(COUNTIFS(Data!N:N,$W$5,Data!D:D,{"* 3","*03"},Data!M:M,">"&$T$4))

Changes to your formula marked in red.

This will count anything ending in 3 or 03 (while matching the other criteria as well).
 
Upvote 0
Worked like a charm - and then I found out just how much inconsistent data are.

You gave me a new trick though (the {array of conditions}) - and that helped immensely.

Thanks!!



You can try

=SUM(COUNTIFS(Data!N:N,$W$5,Data!D:D,{"* 3","*03"},Data!M:M,">"&$T$4))

Changes to your formula marked in red.

This will count anything ending in 3 or 03 (while matching the other criteria as well).
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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