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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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