# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  Sum if Cells Highlighted Particular Colour

## uberchick

I know I've written a formula like this ages ago, but I can't seem to recall.
I want to write a formula that says to look at a table of cells, and to sum all cells that are highlighted a certain colour.  Does anyone know how to do this?  Thanks in advance!

----------


## shg

Welcome to the forum, uberchick, you've been lurking a long time.

This requires VBA. See http://www.cpearson.com/excel/colors.aspx.

----------


## uberchick

Thanks for the link... unfortunately, my VBA knowledge is almost non-existent.  I'm pretty sure I didn't use VBA to do this before... is there another way?
Thanks in advance!

----------


## shg

If you remember how you did it without VBA, you will earn my praise and admiration.

----------


## EdMac

The only way you could do it without VBA is if the cells are coloured using conditional formatting.

If this is the case, then you could sum them using the same rule as is used to colour them.

----------


## uberchick

Unfortunately, the coloured cells are not conditionally formatted so this won't work.  Thanks anyway!

----------


## shg

Equivalent to EdMac's suggestion, if the cells are colored according to some rule, then you can put a formula that encodes the rule in another column, and use that to conditionally sum the colored cells.

There's potential for error if the cell colors don't allows follow the rule, though.

----------


## royUK

Here's an explanation of using VBA for this

http://www.exceltip.com/st/Sum_by_co...Excel/517.html

----------


## scotty2788

hi there i cant seem to post a thread but i was wondering if you could help inthis one please?

----------


## royUK

> hi there i cant seem to post a thread but i was wondering if you could help inthis one please?



You cannot ask questions like this. Use the New Thread button to ask your own question

----------

