Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Conditionally summing data from two columns depending on their value.

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!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Conditionally summing data from two columns depending on their value.

One way...

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

--
Biff
Microsoft Excel MVP


"Andy" wrote in message
...
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!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Conditionally summing data from two columns depending on theirvalue.

Thanks Biff for the quick solution!

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

On Nov 23, 10:47*am, "T. Valko" wrote:
One way...

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

--
Biff
Microsoft Excel MVP

"Andy" wrote in message

...

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!


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Conditionally summing data from two columns depending on their value.

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


"Andy" wrote in message
...
Thanks Biff for the quick solution!

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

On Nov 23, 10:47 am, "T. Valko" wrote:
One way...

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

--
Biff
Microsoft Excel MVP

"Andy" wrote in message

...

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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing values, x rows deep, depending on a criterion klm[_2_] Excel Worksheet Functions 2 August 18th 08 02:02 PM
summing columns if there is data Dave Excel Worksheet Functions 2 June 22nd 06 08:04 PM
Conditionally summing cells based on conditions in other rows Bert Excel Worksheet Functions 3 June 20th 06 11:06 AM
summing data in several columns david72 Excel Discussion (Misc queries) 3 May 19th 06 07:49 AM
Lock and unlock cells conditionally depending on input in another Frustrated Excel Worksheet Functions 1 November 11th 05 03:36 PM


All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"