Sumif Array formula with range criterion

TallPaul7

New Member
Joined
Apr 19, 2013
Messages
5
Hi All,

I'm having difficulty working out a way to solve the following issue:
I need to sum the number of vehicle trips which fall within a distance range.

eg

12345desired outcome
ATripsDistanceRangeSum of trips in range
B29.405km5.5km ???Formula???0
C13.789.21050--->2.7
D2.736.10100--->(29.4+13.7+2.7)=45.8

<tbody>
</tbody>


The data I'm considering is 2100 rows deep. The range (start km and end km) can consist of any numbers (user-defined interval/series). I need the formula (or VBA code) to check whether the Distance falls within the range (eg AND(">=5","<5.5")). If the distance falls within the range then the trips need to be added to all the other trips within the range.
The outcome must be the sum of all the trips.

I have tried Sumif(B2:D2, AND(B2:D2">=5",B2:D2"<5.5"), B1:D1)
and Dsum(A1:A4, "Trips", B3:B4)
but to no avail.

I think I need an array formula (CTRL+SHIFT+ENTER) but I'm not sure which functions it needs to include and how to arrange them in such a way that the entire data set is searched (w.r.t. distance) and then the SUM of trips returned.

Any help would be much appreciated:)
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi and welcome to Mr Excel Forum (forgot to say...)

Maybe...(Excel 2007 or higher)

=SUMIFS(A:A,B:B,">="&C2,B:B,"<="&D2)

Assumes Trips in column A, Distance in column B and so on

M.
 
Last edited:
Upvote 0
Hi Marcelo,

Thank you for the friendly welcome. I often read MrExcel posts but this time I just had to ask a Q myself. Thank you for the suggestion. It works perfectly. Very simple and efficient too (I've never used SUMIFS before).
Ciao for now
 
Upvote 0
Hi Marcelo,

Thank you for the friendly welcome. I often read MrExcel posts but this time I just had to ask a Q myself. Thank you for the suggestion. It works perfectly. Very simple and efficient too (I've never used SUMIFS before).
Ciao for now

You are very welcome and thanks for the feedback!

M.
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top