Need a Formula to count hight and low digits.

serge

Well-known Member
Joined
Oct 8, 2008
Messages
1,446
Office Version
  1. 2007
Platform
  1. Windows
Hi everyone,

I need help to find out how can I count how many High digits and how many Low digits from a list of 5 numbers ?

The Low digits would be consider : 0,1,2,3,4.
The High digits would be consider : 5,6,7,8,9.

I have in A1 : 05
I have in B1 : 17
I have in C1 : 29
I have in D1 : 34
I have in E1 : 36

and in G1 would be the formula that would give me the count of the low digits and H1 the High digits.

For this example G1 = 6
H1 = 4

Thank you for helping. Serge.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi Serge, try:

=SUMPRODUCT(--(MID(A1&B1&C1&D1&E1,ROW(INDIRECT("1:10")),1)={"0","1","2","3","4"}))

For 5-9, change the last set of numbers to "5","6",etc..

This assumes you will always use five 2-digit numbers (including leading zeros). If you need to account for longer numbers, the formula would need a slight adjustment.
 
Upvote 0
Thank you mvptomlinson,

For your quick respond but it need a small correction if you can ?, the formula need to count the leading "0 ".

Thanks. Serge.
 
Upvote 0
The formula does count leading zeros.

Let me guess, you formatted a cell so that it shows two numbers like 05, but it actually only contains the number 5? If so, don't do that in this case. Excel formulas will not see that as 05. Change the cell formats for those cells to Text and the formula will work when you type 05 into one of the cells.

If you can't/won't change the cell format to text, you would have to change the formula to convert each of the five values into text and then calculate based on that. For example:

=SUMPRODUCT(--(MID(TEXT(A1,"00")&TEXT(B1,"00")&TEXT(C1,"00")&TEXT(D1,"00")&TEXT(E1,"00"),ROW(INDIRECT("1:10")),1)={"0","1","2","3","4"}))
 
Upvote 0
It works perfect,

Thanks so much that is exactly what I needed.
you are terrific.
Thanks!!
 
Upvote 0
another way
Excel Workbook
ABCDEFGH
1050712293073
Sheet1
Excel 2003
Cell Formulas
RangeFormula
G1=SUMPRODUCT(--(--MID(A1:E1,{1;2},1)<=4))
H1=SUMPRODUCT(--(--MID(A1:E1,{1;2},1)>4))
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,683
Members
452,938
Latest member
babeneker

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