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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format Numbers 1

Status
Not open for further replies.

codrutza

Technical User
Mar 31, 2002
357
IE
CR XI

Maybe you help me with that:

formula formula*100
0.0270 2.70
0.0400 4.00
0.0550 5.50
0.1100 11.00
0.0370 3.70
0.0370 3.75
0.0270 2.70
0.0320 3.25

and I need:

result
2.7
4
5.5
11
3.7
3.75
2.7
3.25

Thanks
 
I haven't tried this so I don't know whether it will work or not, but it's worth a shot...

1. Right-click on your number field and select "Format Field..."

2. Go to the Numbers tab and click on the "Customize" button.

3. Click on the formula button to the right of the "Rounding" drop-down.

4. Enter something like this:

if {@MyFormula} = Round({@MyFormula}, 1) then .1 else .01


-Dell

DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year
 
right click the result field ... format field ... customize .. all of your answers are in there

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Hi codrutza

Following on from Dell's suggestion (which I am not sure I would have thought of), go into Format Field and Customise for your resultant formula, and in the formula editor (click on x2) for the Decimals setting enter:

Code:
If      CurrentFieldValue = Round(CurrentFieldValue) 
Then    0
Else    
If      CurrentFieldValue = Round(CurrentFieldValue, 1) 
Then    1
Else    2

Note, this assumes that there wiill be no more than 2 decinal places.

Hope it helps.


Cheers
Pete.
 
Thank you all for your replies.
Dell, the formula it's give me the error Bad formula result. I tested with .1 or 0.1. For instance, when I put 1 I didn’t give me the error. I wonder why.
Pete, it’s working.
 
I hadn't worked with this before so I was making a guess as to what the formula result was supposed to be - it looks like it needs to be the number of places after the decimal instead of the decimal format that's in the drop-down next to the formula button.

I'm glad it works!

-Dell

DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top