ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Calculation (https://www.excelbanter.com/excel-discussion-misc-queries/161869-calculation.html)

AlanW

Calculation
 
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.


JE McGimpsey

Calculation
 
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

In article ,
AlanW wrote:

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.



All times are GMT +1. The time now is 01:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com