word fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to automate a document with a field that calculates travel costs based
on cost/km and km travelled. This is easy enough but there is a maximum
payment of $100. So what I need to do is have a formula that says:

If dist<100 then cost =km*cost/km else $100.

Then I need to sum that answer with other costs on the sheet, so the result
needs to be found in a bookmark.

I have the dist as a bookmark as it is an 'Ask' entry.

I tried using the if statement as {If{dist<100}{dist*0.4}$100}. But it does
not evaluate the if statement correctly.

Any ideas please.

DavidC
 
David,

I don't really understand your varialbles, but if with CC representing
calculated costs a formula something like:

{ IF { CC } < "100"{ CC }"100"}


The { CC } should look something like { =(cost\km*km) }

How you build you formula fields will depend on where the variables
originates (i.e., table cells, formfields, etc.)
 
Thanks for your reply. I think I understand your approach. I would replace
CC with dist*0.4 where dist is the value from a bookmark 'dist' created from
an 'ASK' input box. How though do I then add the result from this field to
sums in other fields to give me a total sum?

The form I have is a basic expenses form, where I get reimbursed for travel
on a per km basis up to $100, plus expenses for other items. These all need
to be totalled to give me a total reimbursable expenses. I am inserting
fields to 'ASK' for the distance travelled and for the other items. I also
understand how to add the various results from the fields except for the
conditional 'IF' field.

DavidC
 
David,

Are you using a proteced form? This might suit you needs better than trying
to to use ASK fields. See:
http://word.mvps.org/FAQs/TblsFldsFms/LinesInForms.htm and the series of
linked articles by Dian Chapman.

OK lets see "dist" is your variable, .40 is your constant, and the maximum
milage allownance is 100.

Try {IF{=({dist}*.40)} < "100"{=({dist}*.40)}"100"}

Now this formula is going to have to be located somewhere (e.g., in a table
cell, a formfield, as a bookmark, etc.)

If you were using a table, you might have a column of subtotals and a
formula at the bottom of the column like {=sum(above)} to give you your
combined total.

or you you could bookmark the equation above as lets say "TA" for travel
allowance and then simply use a ref to the bookmark in a sum { =({ TA }+{
Meals }+{Lodging}) }.
 
Thanks a heap. I forgot the fundamentals again, the brackets around the
formula.

Regards

DavidC
 
Back
Top