Function ColorCode(rng As Range)
ColorCode = rng.Interior.ColorIndex
End Function
Excel Workbook | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
1 | Hdr 1 | Hdr 2 | Hdr 3 | Hdr 4 | Hdr 5 | 149 | 149 | |||
2 | 8 | 7 | 8 | 3 | 8 | |||||
3 | 8 | 7 | 8 | 3 | 6 | |||||
4 | 4 | 7 | 7 | 2 | 10 | |||||
5 | 7 | 9 | 8 | 7 | 10 | |||||
6 | 7 | 2 | 3 | 2 | 3 | |||||
7 | 3 | 6 | 8 | 1 | 9 | |||||
8 | 3 | 10 | 6 | 9 | 3 | |||||
SUMPRODUCT Colour |
Just out of curiosity, as long as you have to call out to a VBA function anyway, why are you having it do only half the job... why not let it pull the values in for those cells it assesses as TRUE and sum them and return that sum instead of having it return TRUE/FALSE values for an Excel SUMPRODUCT to add up for you?Thank you both for your response.. i got another function that takes as input a cell/range along with the "color of interest" and returns true/false.. i used that inline in my SUMPRODUCT call and works like charm..
Thank you both for your response.. i got another function that takes as input a cell/range along with the "color of interest" and returns true/false.. i used that inline in my SUMPRODUCT call and works like charm..