Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number formatting issue - especially when rendering in excel

Status
Not open for further replies.

xlbo

MIS
Mar 26, 2002
15,080
GB
Hi,
I have a report that includes a matrix control. Within some of the
columns, I wish to apply different formatting to change negative
numbers to red. Currently I do this by applying a format of

#,##0.0

to the format property of the cells and

=iif(Fields!PerVarLY.Value < 0 ,"Red","Black")

to the font property

This displays fine in the report itself when rendered into html but when exported to excel, all numbers are coloured red whether positive or negative. It seems to take the font colour from 1 cell in the column and apply that to all the cells regardless of whether they meet the criteria or not. I have tried to remedy this by using INSCOPE to
determine if it is a level of detail issue (there are 2 groups in the report) but it seems not to be the case.

I have noticed that in the formats section of the cell properties, you can prescribe different formats for positive and negative numbers by using a ;
e.g.

#,##0;#,##0.0

will show no decimal places for positive numbers but 1 dp for negative

In MS Excel itself, you can use basic colours in here as well e.g.

#,##0; [red]-#,##0

But this doesn't seem to work in RS, the [Red] is simply accepted as a text string to prefix the number

Anyone got any ideas?

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
bump

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
=iif(Fields!PerVarLY.Value < 0 ,"Red","Black")

to the font property
Did you mean font or color property? I put this same expression in the color property and it worked for me, even with a negative number in the first report record.
 
sorry - meant the font colour property

what version of RS? I am on 2000

Does your report use groupings as I have a feeling that this is the crux of the issue...I have 2 groups within the matrix and I think when rendering in excel, it only uses the value from the 1st element in each group...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hmmmm - just tested this

Very basic report in RS 2000

Number format set to #,##0.0

Font colour set to =IIF(Fields!PerVarLY.Value <0,"Red","Black")

Looks fine when rendered in HTML. Export to Excel and the font colour is set as per the 1st record in the table...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
I'm using 2005. I added a second row group just to see what would happen, and it is still working correctly.
 
ok - looks like a 2000 issue then

Thanks for posting back

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top