CountIf formula

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I've been playing around with some advanced functions and though I can get this to work with helper columns, I'd like to try and combine all of this into one function.

Let's say you have cell entries such as ABC3390 60-P, ABC2517 1350 45-N. Each of these are in separate cells. I need to extract the numerical score which fortunately is in the 9th position and so do that with =MID(A1,9,2), then I convert that to a value by =VALUE(MID(A1,9,2) and then need to use COUNTIF to return the number of values that exceed 49. Can these functions be combined into a one cell formula for convenience?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try this, assuming you have values of interest in A1:A7 (adjust as necessary)
=SUMPRODUCT(--(VALUE(MID(A1:A7,9,2))>49))
 
Upvote 0
Try this, assuming you have values of interest in A1:A7 (adjust as necessary)
=SUMPRODUCT(--(VALUE(MID(A1:A7,9,2))>49))
Thanks Kirk, I get a #VALUE error when I put data into A1:A7, if I restrict this to A1 only ie A1:A1 then it works.
 
Upvote 0
What about the code I provided in a previous thread, that sums ALL of the counts into a MsgBox....but it could go straight to a cell if required !
 
Upvote 0
Thanks Kirk, I get a #VALUE error when I put data into A1:A7, if I restrict this to A1 only ie A1:A1 then it works.
It would seem that if there's an empty cell in the range, it throws the formula off and an error is returned.
 
Upvote 0
Try this Array formula (Ctrl+Shift+Enter):

=SUM(--IFERROR((--MID(A2:A15,9,2)>49),0))
 
Upvote 0
Let's say you have cell entries such as ABC3390 60-P, ABC2517 1350 45-N.
Is that really what your data might look like? Going by a previous thread thread of yours with similar data, isn't the score in that red value 45, not 13?

Also, going back to another comment in that previous thread, scores of less than 10 were possible meaning that the score for those would not be MID(A1,9,2)
Has that circumstance changed?
 
Upvote 0
Is that really what your data might look like? Going by a previous thread thread of yours with similar data, isn't the score in that red value 45, not 13?

Also, going back to another comment in that previous thread, scores of less than 10 were possible meaning that the score for those would not be MID(A1,9,2)
Has that circumstance changed?
Good pickup, yes the 1350 is redundant and shouldn't be there and yes it is possible that someone could score less than 10 creating a formula error. I shared the solutions from the previous post with a co-worker who thought that there might be an easier way through COUNTIF or possibly SUMPRODUCT, I did play around with them but couldn't quite get them to work.
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,710
Members
449,182
Latest member
mrlanc20

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