ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   USE THE "IF" STATEMENT IN EXCEL (https://www.excelbanter.com/excel-programming/442630-use-if-statement-excel.html)

PRECISION SAILOR

USE THE "IF" STATEMENT IN EXCEL
 
I would like to use an IF statement to program events on an EXCEL spread sheet.
For example, "IF G136 P32 THEN +1.0". Can this be done???
THANKS! RAFAEL DE ECHEANDIA, HAMPTON, VA


Rick Rothstein

USE THE "IF" STATEMENT IN EXCEL
 
We are talking about VB code, not worksheet formulas, correct? Can you
provide more detail as to what your example is supposed to be doing (what
kind of events, add 1 to what, etc.)?

--
Rick (MVP - Excel)



"PRECISION SAILOR" <PRECISION wrote in
message ...
I would like to use an IF statement to program events on an EXCEL spread
sheet.
For example, "IF G136 P32 THEN +1.0". Can this be done???
THANKS! RAFAEL DE ECHEANDIA, HAMPTON, VA


Don Guillett[_2_]

USE THE "IF" STATEMENT IN EXCEL
 
Your question is not clear to me. As ALWAYS post your code for comments.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"PRECISION SAILOR" <PRECISION
wrote in
message ...
I would like to use an IF statement to program events on an EXCEL spread
sheet.
For example, "IF G136 P32 THEN +1.0". Can this be done???
THANKS! RAFAEL DE ECHEANDIA, HAMPTON, VA



Ayo

USE THE "IF" STATEMENT IN EXCEL
 
Not exactly sure what you mean by "+1.0" but this is how you write and IF
statement in excel:
=If(G136P32,"+1.0","")
If(condition,answer_if_cond_true,answer_if_cond_fa lse)

"PRECISION SAILOR" wrote:

I would like to use an IF statement to program events on an EXCEL spread sheet.
For example, "IF G136 P32 THEN +1.0". Can this be done???
THANKS! RAFAEL DE ECHEANDIA, HAMPTON, VA


Gary''s Student

USE THE "IF" STATEMENT IN EXCEL
 
Without VBA:
=IF(G36P36,1,0)
with VBA:
Sub demo()
Set p36 = Range("P36")
Set g36 = Range("G36")
If p36.Value g36.Value Then
ActiveCell.Value = 1
End If
End Sub

--
Gary''s Student - gsnu201003


"PRECISION SAILOR" wrote:

I would like to use an IF statement to program events on an EXCEL spread sheet.
For example, "IF G136 P32 THEN +1.0". Can this be done???
THANKS! RAFAEL DE ECHEANDIA, HAMPTON, VA



All times are GMT +1. The time now is 11:32 PM.

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