PC Review


Reply
Thread Tools Rate Thread

compound if statement

 
 
Matthew Dyer
Guest
Posts: n/a
 
      7th Oct 2009
How do i make this work?

If Max = 39 Then dpdval = Roll15 _
Else Max = 59 Then dpdval = Roll2 _
Else Max = 89 Then dpdval = Roll3 _
Else Max > 89 Then dpdval = Roll4

the Then in the first else statement is highlighted and I get an error
Expected: end of statement
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      7th Oct 2009
Hi,

Like this but be careful with the use of MAX, it's an excel keyword and you
can get into triuble using it as a variable.

Select Case Max
Case Is = 39
dpdval = Roll15
Case Is = 59
dpdval = Roll2
Case Is = 89
dpdval = Roll3
Case Is > 89
dpdval = Roll4
End Select

Mike

"Matthew Dyer" wrote:

> How do i make this work?
>
> If Max = 39 Then dpdval = Roll15 _
> Else Max = 59 Then dpdval = Roll2 _
> Else Max = 89 Then dpdval = Roll3 _
> Else Max > 89 Then dpdval = Roll4
>
> the Then in the first else statement is highlighted and I get an error
> Expected: end of statement
>

 
Reply With Quote
 
JoeU2004
Guest
Posts: n/a
 
      8th Oct 2009
"Matthew Dyer" <(E-Mail Removed)> wrote:
> How do i make this work?


You can use a Select statement, as MikeH suggests. Probably better.

But all that is wrong with your statement is: you are missing If after each
Else. Try:

If Max = 39 Then dpdval = Roll15 _
Else If Max = 59 Then dpdval = Roll2 _
Else If Max = 89 Then dpdval = Roll3 _
Else If Max > 89 Then dpdval = Roll4


----- original message -----

"Matthew Dyer" <(E-Mail Removed)> wrote in message
news:e4cfcf10-b388-4de5-b0c5-(E-Mail Removed)...
> How do i make this work?
>
> If Max = 39 Then dpdval = Roll15 _
> Else Max = 59 Then dpdval = Roll2 _
> Else Max = 89 Then dpdval = Roll3 _
> Else Max > 89 Then dpdval = Roll4
>
> the Then in the first else statement is highlighted and I get an error
> Expected: end of statement


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compound IIF Statement DAC Microsoft Access Queries 2 26th Jun 2009 07:28 PM
Compound IF statement =?Utf-8?B?RGk=?= Microsoft Excel Programming 8 18th Sep 2007 05:12 PM
Compound IF Statement? =?Utf-8?B?QnJvb2s=?= Microsoft Access Queries 7 10th Mar 2006 06:09 PM
Compound Statement =?Utf-8?B?YmxhZGVsb2Nr?= Microsoft Access Reports 1 26th Sep 2005 05:08 PM
Problem with compound IF statement Phillycheese5 Microsoft Excel Worksheet Functions 11 18th Jul 2005 08:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:28 PM.