Conditionally summing data from two columns depending on their value.

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

I have two columns of data: mileage in A2:A20 and number of passengers
in B2:B20. Each row corresponds to a particular trip. I wish to sum
the number of passenger-miles for trips that have traveled within a
distance range of my discretion (the lower and upper bounds are
specified in A22:A23). How would I do this?

Thanks!
 
Thanks Biff for the quick solution!

(I would add that there should be >= in both instances, so as not to
double count entries.)
 
there should be >= in both instances

Then that means you want to *exclude* the upper boundary.

10...1
12...1
11...1
15...1

Boundaries:

A22 = 10
A23 = 15

=SUMIF(A2:A20,">="&A22,B2:B20)-SUMIF(A2:A20,">="&A23,B2:B20)

Returns 3

=SUMIF(A2:A20,">="&A22,B2:B20)-SUMIF(A2:A20,">"&A23,B2:B20)

Returns 4

--
Biff
Microsoft Excel MVP


Thanks Biff for the quick solution!

(I would add that there should be >= in both instances, so as not to
double count entries.)
 
Back
Top