Thread: If Then
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default If Then

To enter this manually, enter this in F2:

=IF(A2=1,B2*12*0.67,0)

You didn't say what F2 should contain if A2 is not 1, so I just put 0.

To do this using VBA:

If Range("A2").Value = 1 Then
Range("F2").Formula = "=B2*12*.67"
End If

The above code could be part of a VBA procedure.

Hope this helps,

Hutch

"Jamesbfagan" wrote:

How would I program the following formula?

If A2=1 Then F2=B2*12*.67