![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: California
Posts: 105
|
How do I get a sumif formula or something like it to work for the following scenario
Here is my data in column a and b 1 100 2 50 3 70 4 79 5 85 6 60 7 78 8 90 9 100 I want to add anything greater then 3 and less than 8 by looking at column "a" then adding the numbers in column "B"....the result would be 302 (79+85+60+78) Help? |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Quote:
=SUMPRODUCT((A1:A9>3)*(B1:B9))-SUMPRODUCT((A1:A9>=8)*(B1:B9)) This sums all the numbers in column B that are greater than 3, then subtracts the sum of all numbers greater than or equal to 8, giving you 4-7. [ This Message was edited by: Russell Hauf on 2002-03-28 14:27 ] |
|
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
=SUM((A1:A9>3)*(A1:A9<8)*(B1:B9)) Note, this will slow down spreadsheet calculations if you are evaluating a lot of data. Regards,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, CO
Posts: 1,744
|
One more:
=SUMIF(A1:A8,">"&3,B1:B8)-SUMIF(A1:A8,">="&8,B1:B8) good luck |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
=SUMPRODUCT((A1:A9>3)*(B1:B9))-SUMPRODUCT((A1:A9>=8)*(B1:B9)) Much better answer than my Array Formula! No, Barrie. They are exactly equivalent in behavior and, I think also qua cost. The difference is that you don't have to worry about control+shift+enter at entering and at editing with the SUMPRODUCT version. Besides, Russell had better formulated it as: =SUMPRODUCT((A1:A9>3)*(A1:A9<8)*(B1:B9)) or =SUMPRODUCT((A1:A9>3)*(A1:A9<8),(B1:B9)) He probably had SUMIF in mind who knows Aladin [ This Message was edited by: Aladin Akyurek on 2002-03-28 14:46 ] |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
Best regards,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|