Totalling numbers that are Conditionally Formatted

A

Ann Knoff

Is there any way to total up a column by the colours of a cell?

I have a column that has Green, Yellow, Amber and Red cells and I need to
add up how many of each are there and then calculate the percentage.

Any help would be gratefully received!

Ann
 
J

JE McGimpsey

Ann Knoff said:
Is there any way to total up a column by the colours of a cell?

I have a column that has Green, Yellow, Amber and Red cells and I need to
add up how many of each are there and then calculate the percentage.

Any help would be gratefully received!

Since the numbers are conditionally formatted, use the same condition in
your sum. For instance, if values less than 0 are formatted as red, use

=SUMIF(A:A,"<0")/COUNT(A:A)

(formatted as a percentage).
 
A

Ann Knoff

Thank you for responding so quickly. Unfortunately I still can't get it to
work (probably because I am a complete novice)!

The column the conditional formatting in is the O column and the conditions
I am using are as follows:

If the number is between 43 and 56 - Yellow
If the number is between 57 and 84 - Amber
If the number is greater than or equal to 85 - Red

(Oh and the default is Green which is less than or equal to 42 but I
couldn't get 4 conditional formatting items to work)

Any more help you can give would again be greatly appreciated

Ann
 
P

Peo Sjoblom

To sum yellow use

=SUMIF(A1:A100,">=43")-SUMIF(A1:A100,">56")

apply the same technique to the other conditions

--
Regards,

Peo Sjoblom

(No private emails please)
 
A

Ann Knoff

Thank you - that works wonderfully, except (and I obviously wasn't clear on
this - sorry) - I only need it to count the number of cells, not their
contents.

ie there is one red cell in the range, whose contents are 118, and the
formula is returning 118 - I need it to return 1

Does that make any sense?

Ann
 
R

Ragdyer

Try this approach:

ColA ColB ColC
0 42 Green
43 56 Yellow
57 84 Amber
85 10000 Red

Format D1 to D4 as a Percent,
And enter this formula in D1:

=SUMPRODUCT(($O$1:$O$100<>0)*($O$1:$O$100>=A1)*($O$1:$O$100<=B1))/COUNT($O$1
:$O$100)

Copy this formula down to D4.

You should now have your percents alongside your colors.

You *should* enter your largest possible value in B4!
 
P

Peo Sjoblom

Just replace SUMIF with COUNTIF

--
Regards,

Peo Sjoblom

(No private emails please)
 
B

Bob Phillips

Just use COUNTIF instead of SUMIF.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top