I have a formula that uses values found in optional sections... how do I write the formula to avoid

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

There is a read-only field in my form whose value is calculated with the
following formula:

EstimatedCost = EquipmentSubtotal + ServiceSubtotal + MaterialsSubtotal

The 3 subtotals variables on the right hand side which is the meat of the
formula come from optional sections. When either subsection is not used,
the EstimatedCost field will display a NaN value because the expected value
is not defined.

I've tried something like:

EstimatedCost = na(EquipmentSubtotal) + na(ServiceSubtotal) +
na(MaterialsSubtotal)

since, supposedly the "na" function will return a zero if a value is not
present, but in this case the na function doesn't do what I wish it did.
Obviously I'm not doing something right. How can I write a formula that
basically does something like this:

if (EquipmentSubtotal is defined) {EstimatedCost = EstimatedCost +
EquipmentSubtotal };
if (ServiceSubtotal is defined) { EstimatedCost = EstimatedCost +
ServiceSubtotal };
if (MaterialsSubtotal is defined) { EstimatedCost = EstimatedCost +
MaterialsSubtotal }


Thanks,

Stav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top