# Adding Numbers from Formula Results

I have two formulas that produce numbers. I'm trying to add these together in another formula.

Here are the 2 formulas:

{@Charge.Formula.1}

If {Billing_Data22.CPT1} in ['74178'] Then

475

else if {Billing_Data22.CPT1} in ['72148','73721'] Then

520

else if {Billing_Data22.CPT1} in ['70553','72156'] Then

650

else if isnull ({Billing_Data22.CPT1}) Then

0

{@Charge.Formula.2}

If {Billing_Data22.CPT2} in ['74178'] Then

475

else if {Billing_Data22.CPT2} in ['72148','73721'] Then

520

else if {Billing_Data22.CPT2} in ['70553','72156'] Then

650

else if isnull ({Billing_Data22.CPT2}) Then

0

Right now I'm only getting results for the rows that have values for both fields {Billing_Data22.CPT1} and {Billing_Data22.CPT2}. If one of the fields is blank, then the return I'm getting is 0, as opposed to just the number from the non-blank field.

The formula I have that is supposed to be adding these two formulas is this:

{@Charge.Total}

{@ABSO.Charge.Formula} + {@ABSO.Charge.Formula.2}

Thanks!

Rich

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

### Related questions

Posted on May 12, 2015 at 04:56 PM

Hi Rich,

It sounds like the formula is hitting a null before other values. Move the ISNULL portion to the top of the formulas to check for nulls first. You can also go into File | Report Options and turn on the option for Convert Null Values to Default.

Good luck,

Brian

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member
Posted on May 12, 2015 at 04:56 PM

Hi,

Try this:

{@Charge.Formula.1}

if {Billing_Data22.CPT1} <> '' or isnull ({Billing_Data22.CPT2})

(

If {Billing_Data22.CPT1} in ['74178'] Then

475

else if {Billing_Data22.CPT1} in ['72148','73721'] Then

520

else if {Billing_Data22.CPT1} in ['70553','72156'] Then

650

)

Thanks,

DJ

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