mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 18, 2013 8:23 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 1:50 pm 
Offline

Joined: Thu Dec 19, 2002 11:12 pm
Posts: 219
I have a report that exports to excel. On the report i have a variable called 'NetLoss' which is of type Decimal and when there is a negative value then i want to show the value in parenthesis in Excel. For example NetLoss := -5000, i want to show it in excel as (5000) without the negative sign. No matter what i do when it goes to excel it just shows it as -5000, i tried '('+format(Netloss)+'), also i tried DELCHR function to remove the negative sign and no luck and then in MakeDataexcelbody i have

Addcolumn(Netloss,' ',true,true,false).

Does anyone know what can be done to make it work such that it shows (5000).

S.


Top
 Profile E-mail  
 
 Post subject: Re: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 2:10 pm 
Offline

Joined: Thu Nov 17, 2011 9:49 am
Posts: 8
Country: Germany (de)
Code: Select all
format(-Netloss)

or

Code: Select all
format(ABS(Netloss))


The first one: all values change the sign (vice versa)
The second one: always positive.

Decide yourself.


Last edited by winfy on Fri Aug 10, 2012 2:26 pm, edited 2 times in total.

Top
 Profile E-mail  
 
 Post subject: Re: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 2:22 pm 
Offline

Joined: Wed Apr 07, 2004 9:39 am
Posts: 338
Location: Bangalore
Country: India (in)
Excel treats a column with () as a negative number so copy/paste this code:

TxtValue := '( ' + FORMAT(ABS(<NegativeDecimalValue>)) + ')';

and put the TxtValue in the cell. This will work.

Note: Please copy/paste the code because, the space here '( ' after the ( character is not a blank space.

Hope this helps.

Chn


Top
 Profile E-mail WWW  
 
 Post subject: Re: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 2:36 pm 
Offline

Joined: Thu Dec 19, 2002 11:12 pm
Posts: 219
Hi chinoy -

I copied and pasted your code and it shows in excel as -5000 and it you just put it as '('+format(Netloss)+') it shows it as (-5000) and shows the - sign.


Top
 Profile E-mail  
 
 Post subject: Re: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 2:44 pm 
Offline

Joined: Wed Apr 07, 2004 9:39 am
Posts: 338
Location: Bangalore
Country: India (in)
See the attached results it generates with me: (NAV 2009 R2)

[attachment=0]Excel_paranthesis_problem.jpg[/attachment]


Attachments:
Excel_paranthesis_problem.jpg
Excel_paranthesis_problem.jpg [ 75.61 KiB | Viewed 480 times ]
Top
 Profile E-mail WWW  
 
 Post subject: Re: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 2:45 pm 
Offline

Joined: Sat Oct 08, 2005 11:22 am
Posts: 499
Location: TURKEY
Country: Turkey (tr)
Another possibility is inserting #,##0 ;[Red](#,##0);- value to the NumberFormat field in Excel Buffer. (Remove [Red] part if you do not require) This way it will format value using Excel Format Cells property.

_________________
Ufuk Asci
Pargesoft


Top
 Profile  
 
 Post subject: Re: Export to Excel - Negative value in Parenthesis
PostPosted: Fri Aug 10, 2012 3:06 pm 
Offline

Joined: Thu Nov 17, 2011 9:49 am
Posts: 8
Country: Germany (de)
Oh, okay it is new to me!

NumberFormat 0,00;(0,00) works too!


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: