Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Public Function ASAPSumByCellColor(rngSource As Range, sColorIndex As Single) As Single
Dim rngCel As Range
Application.Volatile
N = 0
For Each rngCel In rngSource
If rngCel.Interior.colorindex = sColorIndex Then
If IsNumeric(rngCel.Value) Then N = N + rngCel.Value
End If
Next
ASAPSumByCellColor = N
End Function
Excel 2013/2016 | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | |||||||
2 | 35 | 47 | 3 | 168 | |||
3 | 65 | 77 | |||||
4 | 43 | 55 | |||||
5 | 13 | ||||||
6 | 14 | ||||||
7 | 29 | ||||||
Sheet4 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2 | =ASAPSumByCellColor($A$2:$B$7,D2) |