Formula with arrays

E

eamendes

I would like to make a formula that in the same range, consider only the
cells where the color font is red and acumulate those values. I I wrote
this formula below, but it is not working: *PLEASE HELP!!*

Function BestPrice(MySelection1 As Range, MySelection2 As Range) As
Variant
Dim v1, v2, T As Variant
v2 = MySelection2.Font.ColorIndex
v1 = MySelection1.Value
T = 0
For i = 1 To UBound(v1, 1)
If v2(i, 1) = 3 Then
T = T + v1(i, 1)
Else
T = T
End If
Next
BestPrice = T
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top