Home » excel » arrays – How to subtract values in Excel?

arrays – How to subtract values in Excel?

Posted by: admin May 14, 2020 Leave a comment


Excel Issue

Referring to the snippet of a pivot table below in the image, there are 6,000 J



# models (i.e. J2253993, J2254008, J2254014 … etc).

How can the difference between the last Odometer reading and the first Odometer reading for each model be calculated? There is no consistency in the number of recorded months for each model and there is no consistency between the first and last timestamps for each model.

For model J2253993:
Desired answer is: 378
Because 2501 minus 2123

For model J2254008:
Desired answer is: 178
Because 1231 minus 1053

… And so on for the remaining 6,000 models

Would a dynamic array be needed?

How to&Answers:

Messy SUM/INDIRECT Solution

EDIT: A similar formula for Max-Min in column B (my first idea):


I abandoned it because the image wasn’t showing any empty cells.


The formula is calculating the C column sums. A drawback is that you have to insert ="" in all the empty cells of column C unless you know a way how the MATCH function returns an empty cell. In the E column write the ID-s starting from the 4th row and in F4 write the formula:


Copy/Paste down.

enter image description here


If I am understanding you correctly, it looks like you just need to add a sum of the “Odometer Reading Change” column in your pivot table. When I sum them for J2253993 I get 378 like you say.

Pivot table will total all of the rows by model based on the way you have built it, no matter how many rows are there.