How to check if number is positive or negative

In classic asp, how do I check if a number is positive or negative.
Say 20 - 10 = -10. How do i check if its - 10?
I'm tryin to do a sales report graph where todays data is compared with yesterdays and the percent of increase or decrese is displayed.
So if its -10 Response.write "Decrease in Sales"
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

CWS (haripriya)Connect With a Mentor Commented:
Dim numA, numB, numDiff

numDiff = numA - numB

' All negative numbers are less than zero.
if numDiff < 0 then
      Response.write "Decrease in Sales"
end if

you can format a number....


this will put a parentheses around a negative I guess, you could always do a string check against it...

if instr(formatnumber(strNumber,2,0,-1),"(") > 0 then
  response.write("Decrease In Sales"
end if
Mass Dot NetCommented:
The VBScript Sgn function ( ) sounds like what you need:

The number argument can be any valid numeric expression.

Return Value
The Sgn function has the following return values:

If number is  Sgn returns  
Greater than zero
Equal to zero
Less than zero

-= DeathToSpam =-
All Courses

From novice to tech pro — start learning today.