Help with COUNTIF formula

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
788
Office Version
  1. 365
Platform
  1. Windows
Hi,
i have a row of data containing 8 digit numbers and i want to count the number of 10,20 or 30 at the 5th and 6th digit
is there an easy way to do this?

Example: data in column A

10053001
24224002
14432001
54419030
44301002
10223001
55677501

not sure what to put in for the criteria but formula from above data should output a value of 4
Code:
=COUNTIFS($A:$A,??)

i could do it by creating another formula =MID(A2,5,2) but would prefer not to as theres lots of data

any help appreciated
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
last bit of help needed

this counts the number of cells, but how would i SUM the values of H2:H1000 from the given criteria

Rich (BB code):
=SUMPRODUCT((A2:A1000=B5)*(MID(F2:F1000,5,2)={"10","20","30"}))


i would usually use SUMIFS not sure how to combine it here

thanks
 
Upvote 0
Try:
Code:
[COLOR=#333333]=SUMPRODUCT((A2:A1000=B5)*(MID(F2:F1000,5,2)={"10","20","30"})[/COLOR][COLOR=#ff0000]*(H2:H1000)[/COLOR])
 
Last edited:
Upvote 0
1.

=SUMPRODUCT(--(A2:A1000=B5),--ISNUMBER(MATCH(MID(F2:F1000,5,2)+0,{10,20,30},0)))

2.

=SUMPRODUCT(H2:H1000,--(A2:A1000=B5),--ISNUMBER(MATCH(MID(F2:F1000,5,2)+0,{10,20,30},0)))<strike>
</strike>
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,100
Members
452,301
Latest member
QualityAssurance

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