ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional Summing (https://www.excelbanter.com/excel-discussion-misc-queries/33409-conditional-summing.html)

MartinShort

Conditional Summing
 

Hi there

Can anyone help with the following problem:

Example List
____________

23
45
62
12
8
30
7

I want to sum all of the numbers LESS THAN or EQUAL TO 45
Also to make things more difficult, I can't use filters and I don't
want to create a UDF in VBA. (The reason for the latter is that I am
convinced that this should be able to be done using a standard Excel
function!)

Any suggestions?

Thanks
Martin


--
MartinShort

Software Tester
------------------------------------------------------------------------
MartinShort's Profile: http://www.excelforum.com/member.php...o&userid=22034
View this thread: http://www.excelforum.com/showthread...hreadid=383821


dominicb


Good morning Martin Short

This can be done using the old chestnut, =SUMIF().

Let's say that the example above occupies range A1 to A7. The formula
in, say, A( should be:

=SUMIF(A1:A7,"<=45",A1:A7)

giving a result of 125.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=383821


Bob Phillips


"dominicb" wrote in
message ...

=SUMIF(A1:A7,"<=45",A1:A7)


You don't need the second array, SUMIF will default to that if not specified

=SUMIF(A1:A7,"<=45")



MartinShort


Thanks Dominic


--
MartinShort

Software Tester
------------------------------------------------------------------------
MartinShort's Profile: http://www.excelforum.com/member.php...o&userid=22034
View this thread: http://www.excelforum.com/showthread...hreadid=383821


MartinShort


Cheers Bob


--
MartinShort

Software Tester
------------------------------------------------------------------------
MartinShort's Profile: http://www.excelforum.com/member.php...o&userid=22034
View this thread: http://www.excelforum.com/showthread...hreadid=383821



All times are GMT +1. The time now is 11:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com