Autosum Range of Cells by Background Color

Copper Contributor

Hello,

 

First id like to say thank you to whomever is willing to help me with this.

 

I have created a spreadsheet to help me track my monthly expenses. For this example I will use Groceries. I track each purchase by color coding each store a different color. So the background of each purchase is manually highlighted depending on which store the purchase was made. I am trying to figure out how to autosum the amount spent each month by the background color of the cells. I have attached an example. I hope I have explained this clearly enough. Please let me know if you have any questions.

 

Thank you again.

4 Replies

Thank you for your reply. I followed the link and am still not 100% sure on how to do this. Using my spreadsheet example in my previous post I used the following formula in cell C20 and the result is "#NAME?". =SUM(C6:C19*(COLORINDEXOFRANGE(C6:C19,FALSE,1)=3)) @Hans Vogelaar 

@bdubs 

You need to create some code in the Visual Basic Editor and save the workbook as a macro-enabled workbook (.xlsm)

I have added a much simplified version of the SumColor function from that article to your workbook.

Make sure that you allow macros when you open the workbook.

 

S0343.png

Thank you for all of your help! @Hans Vogelaar