ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum or Count? (https://www.excelbanter.com/excel-programming/430514-sum-count.html)

Bishop

Sum or Count?
 

I have a single column that contains multiple entries of 7 different ratings:
P, PG, PG13, R, NC17, X, Unrated. I'm trying to initialize a Summary
userform with the sum of each of these and assign these sums to a label for
each of the ratings. I thought about Sum or Count but I can't figure out the
best way to extract all the entries for each rating, get a total and assign
it to a variable. Any ideas?

JLGWhiz[_2_]

Sum or Count?
 

If you want to use a formula:

="P = " & COUNTIF(A3:A15, "P")

I used rang A3:A15, but you can use whatever range the criteria is in.
CountIf
concatenated to each rating, i.e. "PG = ", PG13 = ", etc. will give you an
output
like P = 5, PG = 11, etc. You need a formula for each rating code in their
individual cells.


"Bishop" wrote in message
...
I have a single column that contains multiple entries of 7 different
ratings:
P, PG, PG13, R, NC17, X, Unrated. I'm trying to initialize a Summary
userform with the sum of each of these and assign these sums to a label
for
each of the ratings. I thought about Sum or Count but I can't figure out
the
best way to extract all the entries for each rating, get a total and
assign
it to a variable. Any ideas?




Harald Staff[_2_]

Sum or Count?
 
A Pivot table does this in no time. But you need it in code onto a userform?
If your entries are strictly limited and at all times properly spelled <g,
this might be a start:

Sub test()
MsgBox Application.WorksheetFunction.CountIf(Sheets(1).Ra nge("A1:A1000"),
"PG13")
End Sub

COUNTIF is the proper spreadsheet formula here if I understand you correct.

HTH. Best wishes Harald


"Bishop" wrote in message
...
I have a single column that contains multiple entries of 7 different
ratings:
P, PG, PG13, R, NC17, X, Unrated. I'm trying to initialize a Summary
userform with the sum of each of these and assign these sums to a label
for
each of the ratings. I thought about Sum or Count but I can't figure out
the
best way to extract all the entries for each rating, get a total and
assign
it to a variable. Any ideas?



-----------------------------------------------------------------------------
Our Peering Groups change
Visit : http://spacesst.com/peerin

Bernd P

Sum or Count?
 
Hello,

I suggest to use mz UDF Pstat:
http://www.sulprobil.com/html/pstat.html

Regards,
Bernd


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com