Sumif - applying function to the criteria

TheBigDog

Board Regular
Joined
Aug 5, 2002
Messages
56
Here is the what the two columns look like

Date Profit
1/1/2006 1
2/2/2006 2
2/3/2006 3
4/4/2006 4


I want to get the sum of the profit only if the month is Feb by using the Month() function (return a number from 1-12, signifying a month)

Can I do that with a SumIf statement? if not, any good suggestions? (without creating another column)

Thanks in advance.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Try:

=SUM(IF(MONTH(A1:A10)=2,B1:B10))

adjust ranges to suit.

confirmed with CTRL+SHIFT+ENTER not just ENTER...
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
Book1
ABCDEFG
1DateProfit
21/1/200611-Feb-0628-Feb-065
32/2/20062
42/3/20063
54/4/20064
6
Sheet1


F2:

=EOMONTH(E2,0)

G2

=SUMIF($A$2:$A$5,">="&E2,$B$2:$B$5)-SUMIF($A$2:$A$5,">"&F2,$B$2:$B$5)
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
Thanks for the CSE help. That should do it.

If you ensure that all months are of the same year in the target range. Otherwise you need to expand the suggested formula.
 

Forum statistics

Threads
1,136,368
Messages
5,675,358
Members
419,565
Latest member
Phil57

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
Top