You are viewing limited content. For full access, please sign in.

Question

Question

Error when attempting to subtract one field from another

asked on March 8, 2018 Show version history

I haven't used the calculations feature a lot, so may be doing this wrong.  I am attempted to calculate the total miles driven.  The calculations are within a collection.  My formula is =SUB(MileageDetails.At_Finish,MileageDetails.At_Start).  I keep getting an error, "This field contains a calculation error.  References: At Finish, At Start."  Can someone tell me what I am doing wrong?

0 0

Answer

SELECTED ANSWER
replied on March 8, 2018

Or you could try something like this

=SUB(INDEX(MileageDetails.At_Finish,row()),INDEX(MileageDetails.At_Start,row()))

This is taking the finish value at that row of the collection and subtracting it by the start value at that row of the collection. The total mileage will be calculated separately at each row. Then you could sum them all up outside of the collection to get the total mileage of all trips. 

1 0

Replies

replied on March 8, 2018 Show version history

This should get you closer:

=SUM(MileageDetails.At_Finish,-SUM(MileageDetails.At_Start))

Maybe you can hide the Total until the "At Finish" blurs or something, so that you don't end up with negative numbers after the first box.

TotalSubtract.PNG
0 0
replied on March 8, 2018

Vanessa,

Use Jared Rechnitz's answer. Mine only works for a single set.

0 0
replied on March 8, 2018

Thank you Jared! That worked perfectlysmiley

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.