Skip to Content

### Convert Sum value to text

Hello!

Trying to convert a sum value to appear as text.

Here is my formula:

if Sum ({@Thurs Daily Count})=0 then 0 else

Sum ({@Thurs Daily Count},{PTS_1_18_13_10_09.Scheduler}) / Sum ({@Thurs Daily Count})*100

I want to have this appear as "NA" instead of appearing as 0.  I believe I'll need to convert the number 0 to text "NA".....?  Thanks!

Rich

##### Add comment
10|10000 characters needed characters exceeded

### 2 Answers

• Best Answer
Dec 30, 2014 at 05:36 PM

Hi Rich,

Change the code to:

if Sum ({@Thurs Daily Count}) = 0 then "N/A" else

totext(Sum ({@Thurs Daily Count},{PTS_1_18_13_10_09.Scheduler}) / Sum ({@Thurs Daily Count})*100)

-Abhilash

##### Add comment
10|10000 characters needed characters exceeded
• Dec 30, 2014 at 05:36 PM

Try something like this:

if Sum ({@Thurs Daily Count})=0 then 'NA' else

ToText(Sum ({@Thurs Daily Count},{PTS_1_18_13_10_09.Scheduler}) % Sum ({@Thurs Daily Count}))

The '%' operator will automatically set the number as a percent so you don't have to explicitly use "*100" in your formula.

Note that both values in the If statement must be of the same data type.  If you want to tweak the format of output from the "else", look in the Crystal help for the ToText() function - there are a number of formatting options.

-Dell

##### Add comment
10|10000 characters needed characters exceeded