| | |
|
|
|
IIF with left(field,1) |
| message from =?Utf-8?B?Sk1vcnJlbGw=?= on 6 May 2004 |
Can someone tell me why
=IIf(Left([c],1)="-",Left([c],1)="+","")
returns a value of 0 when true, instead of +?
I want a negative number to print/show as a positive number (field type is double).
tia,
JMorrell
|
| SteveD replied to =?Utf-8?B?Sk1vcnJlbGw=?= on 6 May 2004 |
another way is to use the absolute function ABS([field])
this will always return a positive number.
SteveD
number (field type is double).
|
| =?Utf-8?B?Sk1vcnJlbGw=?= replied to SteveD on 6 May 2004 |
Actually, I need to have the plus sign in front of the value. Am I going to have to string it together?
|
| Van T. Dinh replied to =?Utf-8?B?Sk1vcnJlbGw=?= on 8 May 2004 |
Use the formating string "+0.00;-0.00" (or something similar) which has 2
components. The first component is for +ve numbers and zeros; the second
component for -ve numbers.
?Format(3, "+0.00;-0.00")
+3.00
?Format(-3, "+0.00;-0.00")
-3.00
|
| SteveD replied to Van T. Dinh on 10 May 2004 |
very cool - another way to use the format function.
Thanks,
SteveD
similar) which has 2
zeros; the second
value. Am I going
|
| SteveD replied to =?Utf-8?B?Sk1vcnJlbGw=?= on 6 May 2004 |
You want to show a sign - not remove it.
Are you doing any calculating with it?
if no - then string together on the form or report.
if yes - a new field could be used for a "text" version
and keep the numeric version for computing, only
Displaying the "text" version.
value. Am I going to have to string it together?
|
| Tom Slickers replied to =?Utf-8?B?Sk1vcnJlbGw=?= on 6 May 2004 |
IIF has three arguments. It returns the second or third argument, depending
on whether or not the first one is True or False, respectively. In your
case, if c is negative, then IIF evaluates the second argument as a boolean
expression, which is False and returns 0 (0=False).
Try the following:
=IIF(c<0,-c,c)
Tom
"JMorrell" <anonymous@discussions.microsoft.com> wrote in message
news:89E44D56-AECA-4F70-83F1-595EF442857B@microsoft.com...
|
| =?Utf-8?B?Sk1vcnJlbGw=?= replied to Tom Slickers on 6 May 2004 |
Thanks for that. The negative number now shows as a "number" but I need to show as a positive number. e.g. if the number returns "-2", it has to show "+2". Am I going to have to change the data type on the fly (if that's even possible)?
|
|
Archived message: IIF with left(field,1) (Microsoft Access Forms)