Using Sumifs based on cell color AND Date Range

SandyG

New Member
Joined
Oct 4, 2013
Messages
31
Good day! I have an Excel workbook that I am tracking labor costs, committed and actual. For the actual costs, I am using the "sumbycolor" code and it works great.

I need to be able to also create a formula based on cell color and date range. So, I think I need to use a "sumifs" with a "sumbycolor".

This is the code that I have in my module.

Code:
Function SumByColor(CellColor As Range, SumRange As Range)
Application.Volatile
Dim ICol As Integer
Dim TCell As Range
ICol = CellColor.Interior.ColorIndex
For Each TCell In SumRange
If ICol = TCell.Interior.ColorIndex Then
SumByColor = SumByColor + TCell.Value
End If
Next TCell
End Function

The code works great for summing anything by color. And updates as new cells are colored.

Here is what I'm looking for:

Jan has worked a total of 120 hours from 4/1/18 - 4/30/18, and we have been invoiced $3000 so far (the fields are colored in green to show the $3000 invoiced amount). There is still $2000 that has not been invoiced for the month, and they are not colored.

The formula would be: Sumif (the color of field is green) AND (date range is between 4/1/18 - 4/30/18).

Can anyone help? :confused:
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top