Skip to main content
Participant
December 8, 2021
Beantwortet

How to subtract one field from another and sum a range of fields

  • December 8, 2021
  • 2 Antworten
  • 8376 Ansichten

I created a form in Word that I converted to a fillable pdf form using the prepare form feature for a template for a mileage log. I would like to create a formula that calculates miles driven for each row where it takes the odometer reading at destination point and subtracts the odometer reading at starting point. I know how to create the formula for the first row, however my table has 60 rows and I would like to copy the formula in the first cell to the cells in the other rows. Is there anyway to do this or do I have to create the formula for the cells in the other rows one by one? Also, I would like to create a cell that totals the miles driven for all of the rows in the miles driven column that will be labeled total mileage. Is there a formula that would allow me to do that? I have attached a template of the form I created to this post. If I can have assistance on this it would be much appreciated.

Dieses Thema wurde für Antworten geschlossen.
Beste Antwort von Nesa Nurani

Here is your file with scripts included https://drive.google.com/uc?export=download&id=1Q-pZ7JGqdMZpC6tRHTtY52BilQ9Rq_C2 

For miles driven, script is in "Miles DrivenRow1" field under calculate tab -> custom calculation script.

For total mileage, script is in "Total Mileage" field under calculate tab -> custom calculation script.

Since you only have 22 fields in your sample, I set that number in scripts so you can test it, and since you said you have total of 60 rows, in both scripts change 22 to 60 for your original file.

2 Antworten

Nesa Nurani
Community Expert
Community Expert
December 8, 2021

Here is your file with scripts included https://drive.google.com/uc?export=download&id=1Q-pZ7JGqdMZpC6tRHTtY52BilQ9Rq_C2 

For miles driven, script is in "Miles DrivenRow1" field under calculate tab -> custom calculation script.

For total mileage, script is in "Total Mileage" field under calculate tab -> custom calculation script.

Since you only have 22 fields in your sample, I set that number in scripts so you can test it, and since you said you have total of 60 rows, in both scripts change 22 to 60 for your original file.

Participant
December 10, 2021
Thanks!

How were you able to copy and paste the formula for miles driven in the
first row to all the other rows? Also what was the formula you used for
total miles?
Nesa Nurani
Community Expert
Community Expert
December 11, 2021

It's not pasted in all rows, it's only in one field but it works for other fields aswell (the 22 ones you have in sample file, to make it work for all your fields, read my post I explained how to do it).

Script for miles is in total miles field, it sums all "Miles DrivenRow" fields, do you need it to do something else?

JR Boulay
Community Expert
Community Expert
December 8, 2021

-----------

Acrobate du PDF, InDesigner et Photoshopographe