Calculation

G

Guest

Under the condition, if

A1=0 and A2 = 1-1/2, then B1 = Good
A1=0 and A2 = 2-3/4, then B1 = Excellent
A1=0 and A2 > 2-3/4, then B1 = Superb

A3=0 and A4 = 1-1/2, then B3 = Good
A3=0 and A4 = 2-3/4, then B3= Excellent
A3=0 and A4 > 2-3/4, then B3= Superb,
and so on…

I would like to do it by VBA, could someone please help.
 
J

JE McGimpsey

One way:

Dim rCell As Range
For Each rCell In Range("A1,A3")
With rCell
If .Value = 0 Then
Select Case .Offset(1, 0).Value
Case Is = 1.5
.Offset(0, 1).Value = "Good"
Case Is = 2.75
.Offset(0, 1).Value = "Excellent"
Case Is > 2.75
.Offset(0, 1).Value = "Superb"
Case Else
.Offset(0, 1).ClearContents
End Select
End If
End With
Next rCell
 

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