View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sheela[_2_] Sheela[_2_] is offline
external usenet poster
 
Posts: 8
Default If..Else Statement in Excel

What
is max condition can u have in an If...Else Statement. I
have four conditions. How do I apply the if...else
statement on this conditions?

As what I know and have tried, in an if..else statement,
we can only have one "else if" and one "else" within the
structure. I hope I'm not being confusing.

I have include the code:

================================================== ===
If txtDmdPeak.Text <= txtDtotal.Text Then
'Firm - Normal Bill
If Answer = True Then
If txtCalculatedDemand.Text < txtDsbf.Text Then
txtFirmStandbyCharge.Text = (txtDsbf.Value -
txtCalculatedDemand.Value) * txtMaxDmcFirm.Value
If txtFirmStandbyCharge.Value = "" Then
txtFirmStandbyCharge.Value = "0"
Else
txtFirmStandbyCharge.Value = Format
(txtFirmStandbyCharge.Value, "######.##")
End If
End If

If txtDsbf.Text < txtCalculatedDemand.Text Then
If txtCalculatedDemand.Text < txtDtotal.Text
Then
txtFirmStandbyCharge.Text =
(txtDtotal.Value -
txtCalculatedDemand.Value) * txtMaxDmcNonFirm.Value
If txtFirmStandbyCharge.Text = "" Then
txtFirmStandbyCharge.Text = "0"
Else
txtFirmStandbyCharge.Value = Format
(txtFirmStandbyCharge.Value, "######.##")
End If
End If
End If
================================================== ========
I have posted this question earlier but there wasn't any
reply to this. The only advise was replied to me was that
I should replace the inner if to else if. But again, pls
verify the statement that I made in my first & second
paragraph.

Thank you very much in advance for your help.

Sheela