Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I create an If then statement in excell?
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If something = True then
'do something End If or did you mean in a worksheet formula ? =IF(A1="Oranges","Fruity","No fruit") Tim "BMatson" wrote in message ... How do I create an If then statement in excell? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=IF(test condition, true action, false action)
Help on the function will give more details. Here are a couple of examples: =IF(A1=4, "A1 does equal 4","") shows blank if A1 doesn't = 4. =IF(A1=A5,(A1+A5)*3,0) ' adds A1+ A5 and multiplies result by 3 if A1=A5, results is zero if not equal. =IF(AND(B1=3,X5="Ripe"),"conditions met","conditions not met") IF statements can be nested, with another IF statement being placed in either the True or False action portions of each. You can carry this on to a total of 7 nested functions in pre-2007 versions of Excel. "BMatson" wrote: How do I create an If then statement in excell? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In my previous post I showed how to use the worksheet function IF. Now,
since this is the Programming group, perhaps you're looking for VBA code? In that case: Sub Dummy() IF Range("X1").Value = 4 Then Range("X2").Value = "X1 is 4" ' or some math or whatever Range("X3").Value = "I said: X1 is 4!" ' can use multiple statements End if End Sub there is also the IF...Then...Else variation, and the If...Then...ElseIf... variation. VBA Help has discussions of these. "BMatson" wrote: How do I create an If then statement in excell? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hit [Enter] too soon!
Sub TestIfThenElse() IF Range("X1").Value = 4 Then 'code to perform when condition is true Else 'code to perform when condition is not true End If You can have multiple code statements in both the Then section and the Else section if you need them. "BMatson" wrote: How do I create an If then statement in excell? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is it possible to change the normal excell icon on an excell file? | Excel Worksheet Functions | |||
Excell 2000 IF Statement | Excel Discussion (Misc queries) | |||
Excell Books how to create a financial statement? (4 dummies) | Excel Discussion (Misc queries) | |||
how do you open an excell email attacment, if I dont have excell | Excel Discussion (Misc queries) | |||
If then statement Excell 2000 | Setting up and Configuration of Excel |