# Microsoft Office Application Help - Excel Help forum > Excel Formulas & Functions >  > [SOLVED] SUMIF (cell color)

## snowb46

Can a colr be used as a condition of SUMIF?

I have a column that needs 2B sum'd, but only the one that are (YELLOW).

I've not been able to find anything in the HELP section of EXCEL that deals with color.

----------


## Fotis1991

Not using formulae. You need VBA for this. See here how.

http://www.excelexchange.com/SumByColor.html

----------


## Moo the Dog

I don't know about using SUMIF with cell colors, but is there actual logic involved in which cells that get colored? If so, then there is almost certainly a way to do what you want to do - Excel and logic are like peanut butter and jelly.

- Moo

----------


## snowb46

Fotis,

Thanks a bunch.  First time I used VBA.  Took me a bit to figure out that it was connected in a MODULE rather than part of the worksheet... but got it none the less.

You said you had a function VOLATILE.  Are you willing to share that as well?

Thanks again

----------


## pgwatbok

I am not sure what I am doing wrong, but I pasted the above data into a VBF code sheet (not sure if that is what it is called because I am unfamiliar with VBF).  I saved the file. When I went back to Excel and tried the formula you had on the sheet, I got an error message of #NAME?.  When I click on evauate formula it shows that the part of the formula that contains =sumbycolor is an invallid name.  Any suggestions as to what I need to change?  Is it something in the way I am saving

----------


## pgwatbok

I finally was able to get it to work.  I had to save my spreadsheet as an .xlsm file.

----------

