You need to sign in to do that
Don't have an account?
Steve_Early
Problems getting 2 decimal points to display on Text formula field
We are using this set of formulas to test to see if the quantity price is null. If it isn't it should be output, otherwise it is skipped.
IF(ISNULL(Product2.Qty_1_9__c),"","$"&TEXT(Product2.Qty_1_9__c)&BR())
&IF(ISNULL(Product2.Qty_10_49__c),"","$"&TEXT(Product2.Qty_10_49__c)&BR())
&IF(ISNULL(Product2.Qty_50_199__c),"","$"&TEXT(Product2.Qty_50_199__c)&BR())
&IF(ISNULL(Product2.Qty_200_499__c),"","$"&TEXT(Product2.Qty_200_499__c)&BR())
&IF(ISNULL(Product2.Qty_500_999__c),"","$"&TEXT(Product2.Qty_500_999__c)&BR())
&IF(ISNULL(Product2.Qty_1000__c),"","$"&TEXT(Product2.Qty_1000__c)&BR())),"",
The goal is to have output on a Quote:
Qty 1-9 $15
Qty 10-19 $14.45
Qty 20-39 $13.95
It works fine with one exeption: If the price ends in zeroes ($15.00) on the PDF output we are seeing is "$15.0" - the second zero is being dropped. The field involved is set up with 2 decimal places.
Is there anything I can put in this formula to force the second 0 to print on PDF output?
IF(ISNULL(Product2.Qty_1_9__c),"","$"&TEXT(Product2.Qty_1_9__c)&BR())
&IF(ISNULL(Product2.Qty_10_49__c),"","$"&TEXT(Product2.Qty_10_49__c)&BR())
&IF(ISNULL(Product2.Qty_50_199__c),"","$"&TEXT(Product2.Qty_50_199__c)&BR())
&IF(ISNULL(Product2.Qty_200_499__c),"","$"&TEXT(Product2.Qty_200_499__c)&BR())
&IF(ISNULL(Product2.Qty_500_999__c),"","$"&TEXT(Product2.Qty_500_999__c)&BR())
&IF(ISNULL(Product2.Qty_1000__c),"","$"&TEXT(Product2.Qty_1000__c)&BR())),"",
The goal is to have output on a Quote:
Qty 1-9 $15
Qty 10-19 $14.45
Qty 20-39 $13.95
It works fine with one exeption: If the price ends in zeroes ($15.00) on the PDF output we are seeing is "$15.0" - the second zero is being dropped. The field involved is set up with 2 decimal places.
Is there anything I can put in this formula to force the second 0 to print on PDF output?
"$" + text( floor( My_Number__c ) ) + "." + right( text( ( 1 + My_Number__c - floor( My_Number__c ) ) * 100 ), 2 )
We treat the integer and decimal parts separately, and reassemble them.
First, separate out the integer and decimal parts using the floor() function, which always rounds down.
Then add 1 to the decimal part, and multiply by a hundred, so for zero decimal, we get "100" in text.
Finally trim the "1" from the decimal part by using the right() function.
All Answers
As you said your field involved is set up with 2 decimal places.
so which field Qty_1_9__c. If yes this one
then what about Formula field it also have Options for Decimal Places.
Ley me know if it helped.
Regards
Virendra
Yes the Qty_1_9__c field is set up as a currency field with 2 decimal places. The formula field here (Quantity_Pricing__c) is set to TEXT as the output so that we can display "$" on a quote instead of "USD". There is no option for decimal plasces.
"$" + text( floor( My_Number__c ) ) + "." + right( text( ( 1 + My_Number__c - floor( My_Number__c ) ) * 100 ), 2 )
We treat the integer and decimal parts separately, and reassemble them.
First, separate out the integer and decimal parts using the floor() function, which always rounds down.
Then add 1 to the decimal part, and multiply by a hundred, so for zero decimal, we get "100" in text.
Finally trim the "1" from the decimal part by using the right() function.
"$" & text(FLOOR(ROUND(Your_Field,2))) & "." &
LPAD(TEXT(ABS((ROUND(Your_Field,2) - FLOOR(ROUND(Your_Field,2)))*100)), 2 , "0")