IF statement problems -- and thanks to Bill

# Thread: IF statement problems -- and thanks to Bill

1. Senior Member
Join Date
Dec 1969
Posts
1,388

## IF statement problems -- and thanks to Bill

Well before i can just count weekdays I need to get my calculations straight which should work IMO. As long as my charging days is under 10 it works right. After 10 it executes the wrong side of the if statement. numofdays is the number of days at the first price and chargedays is the number of days being charged. So if chargedays is less than the number of days at the first price. so in this case if chargedays=10 and numofdays=5 it should go to the else but its not...My code:<BR><BR>numofdays = trim(numofdays)<BR>chargedays = trim(chargedays)<BR><BR>response.write "numofdays = " & numofdays & "<BR>"<BR><BR>response.write "chargedays = " & chargedays & "<BR>"<BR><BR>if chargedays &#060;= numofdays then<BR><BR> response.write "i made it here"<BR> days1=chargedays<BR> subtotal1 = days1 * price<BR> grandtotal = subtotal1 + subtotal2<BR> days2=0<BR> subtotal2=0<BR><BR>else<BR><BR> response.write "here i am"<BR> days1=numofdays<BR> response.write days1<BR> subtotal1 = days1 * price<BR> subtotal2 = days2 * price2<BR> grandtotal = subtotal1 + subtotal2<BR><BR>end if<BR><BR>And thanks bill for the weekday code and yes its free on holidays too thats another problem hehe<BR><BR>Matt

2. Senior Member
Join Date
Dec 1969
Posts
213

## RE: IF statement problems -- and thanks to Bill

Maybe your strings need converted to numbers so that the<BR>comparisons will work right: <BR>if len("" & trim(strNumOfDays))&#062;0 then<BR> if IsNumeric(strNumOfDays) then<BR> intNumOfDays = cInt(strNumOfDays) <BR> end if<BR>end if

3. Senior Member
Join Date
Dec 1969
Posts
1,388

## RE: IF statement problems -- and thanks to Bill

That worked.<BR><BR>Thanks,<BR><BR>Matt

#### Posting Permissions

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