If... statement syntax

1. Nick Herbert Guest

## If... statement syntax

I&#039;m writing a function to calculate discount on orders (see end of message).<BR><BR>I want to a discount of 10% on orders above 1000 and below 2000.<BR><BR>I tried this:<BR><BR>Elseif Price =&#062; 1000 & Price &#060; 2000 Then<BR><BR>But it doesn&#039;t work.<BR><BR>What is the correct syntax for the statement?<BR><BR><BR>Many thanks,<BR><BR><BR>Nick<BR><BR><BR><BR><BR>Functio n CalculateDiscount(Price)<BR>If Price &#060; 1000 Then<BR>Discount = 0<BR>Elseif Price =&#062; 1000 & Price &#060; 2000 Then<BR>Discount = 0.1 * Price<BR>Elseif Price =&#062; 2000 Then<BR>Discount = 0.15 * Price<BR>Elseif Price =&#062; 4000 Then<BR>Discount = 0.20 * Price<BR>Elseif Price =&#062; 8000 Then<BR>Discount = 0.25 * Price<BR>Else<BR>Discount = 999<BR>End If<BR>End Function<BR><BR>

2. ShawnPhelps Guest

## RE: If... statement syntax

I believe & must be AND... im an amatuer so im not sure though...

3. Member
Join Date
Dec 1969
Posts
63

## RE: TRY THIS

select case price<BR>case price &#062;1000 and price &#060; 2000:<BR>&#039;&#039;your statement.<BR>case ...<BR><BR>case....<BR>end select<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•