SUMIF or COUNTIF using LEN for a range as a criteria

Jacowork

New Member
Joined
Mar 4, 2013
Messages
6
Hi guys,

I'm trying to figure something out.
A:A has values with 12 or 13 characters, I need to count the number of times each value returns.
I tried =COUNTIF(A2:A11;LEN(A2:A11)=12), but this results in 0 instead of 6.

Any help? I couldn't find any answers that worked for me.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Enter this as an array formula (hold ctrl shift and hit enter when inputting it).

=SUM((LEN(A2:A11)=12)*1)
 
Upvote 0
Enter this as an array formula (hold ctrl shift and hit enter when inputting it).

=SUM((LEN(A2:A11)=12)*1)

Great.

But now, why the SUM *1?
And why the Shift Ctrl?
:oops:
I'm trying to understand it too, for future references. To build logical formulas.

But again, thanks! :pray:
 
Upvote 0
Enter this as an array formula (hold ctrl shift and hit enter when inputting it).

=SUM((LEN(A2:A11)=12)*1)

And how do I add another criteria?
I would like to add a criteria where column C has an amount of 50,500 and 5000. To know how many times a 500 amount is given with a 12 character value....
123456789123User1
50
123456789123User2500
1234567891234User3500
1234567891234User4500
123456789123User550
1234567891234User65000
123456789123User75000
123456789123User8500
1234567891234User950

<tbody>
</tbody>


For example I want to know how many users with 1234567891234 have an amount of 500.

With this info I should be able to complete my table.

Thx.
 
Upvote 0
The *1 changes true and false into a number. Ctrl shift makes it an array formula. If you do a search on google for cpearson array formula you will get a good explanation of what they are and how useful they are.

=sumproduct(--(len(A:A)=12),--(C:C=500)) should give you what your looking for.
 
Upvote 0
Fantastic Brian!!!!!!! You're an expert.
I'll start a new thread with another question. This one is solved, kudos.
 
Upvote 0
Oke, forgot something...
I looked for array info on the SUMIF, as proposed.
But can't find how to add the values of C if the have 13 characters.
I found this {=SUM(IF((LEN(A:A)=13)1;0))}, but the result is not the sum of column C, but a count of cells with that length.

I would like to get the result 6050, as that is the sum of values in C corresponding to LEN 13 in column a.

I feel like you should start charging me ;)
 
Upvote 0
I found something basic... but solves the problem, no?
=SUMIF(A:A;"?????????????";C:C) and it works.....

Is this something good or a glitch that makes it work?
 
Upvote 0
If it works it works :)

I personally would use =sumproduct(--(len(A:A)=13),C:C)
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,900
Members
449,194
Latest member
JayEggleton

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