Hello,
This site has been incredibly helpful for me in the past by searching for similar requests by other posters but I could not find an answer to this problem I am facing...
I have been using a UDF I found online to do a sumif based on the text color of the sum range. See below:
Public Function SumByColor(pRange1 As Range, pRange2 As Range) As Double
Application.Volatile
Dim rng As Range
Dim xTotal As Double
xTotal = 0
For Each rng In pRange1
If rng.Font.Color = pRange2.Font.Color Then
xTotal = xTotal + rng.Value
End If
Next
SumByColor = xTotal
End Function
I am now trying to figure out how to combine this with another criteria to only sum if the text is red AND it is Type 1.
Is it possible to combine a UDF with a SumIfs? Do I need another UDF that does both of these? Please help!
This site has been incredibly helpful for me in the past by searching for similar requests by other posters but I could not find an answer to this problem I am facing...
I have been using a UDF I found online to do a sumif based on the text color of the sum range. See below:
Public Function SumByColor(pRange1 As Range, pRange2 As Range) As Double
Application.Volatile
Dim rng As Range
Dim xTotal As Double
xTotal = 0
For Each rng In pRange1
If rng.Font.Color = pRange2.Font.Color Then
xTotal = xTotal + rng.Value
End If
Next
SumByColor = xTotal
End Function
I am now trying to figure out how to combine this with another criteria to only sum if the text is red AND it is Type 1.
Excel 2010 | ||||||||
---|---|---|---|---|---|---|---|---|
B | C | D | E | F | G | |||
5 | Type | Cost | Total Red | 250 | ||||
6 | 1 | $ 20 | Red Type1 | ?? | ||||
7 | 1 | $ 50 | ||||||
8 | 2 | $ 60 | ||||||
9 | 1 | $ 50 | ||||||
10 | 1 | $ 80 | ||||||
11 | 3 | $ 90 | ||||||
12 | 2 | $ 20 | ||||||
Sheet1 |
Is it possible to combine a UDF with a SumIfs? Do I need another UDF that does both of these? Please help!