Sumif(Text(Range,"mmmm"),"January",Range) does not work

kornsatu

New Member
Joined
Feb 20, 2018
Messages
9
Hi,

I have 2-column data record (hourly data in 1 year = 8760 rows), for example:

Column 1 Column 2
1/1/2018 00:00 15
1/1/2018 01:00 20
1/1/2018 02:00 5
.
.
.
31/12/2018 23:00 20


Then, I would like to summarize to monthly value.
What I use is
=sumif(text(A2:A8761,"mmmm"),"January",B2:B8761)

it seems to be not working, I don't understand why?

However, I can use {=sum(if(text(A2:A8761,"mmmm")="January",B2:B8761))} which is in this case working fine.
But I would like to know why sumif function does not work

Thank you for your help
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try this...

=SUMIFS(B:B,A:A,">="&E1,A:A,"<="&EOMONTH(E1,0))

where E1 = 2018-01-01 which is a first day date.
 
Upvote 0
The formula from Post # 2 would omit all the data between 31/1/2018 00:01 and 31/1/2018 23:59. The correct formula is:

=SUMIFS(B:B,A:A,">="&E1,A:A,"<"&EDATE(E1,1))
 
Upvote 0
...
What I use is
=sumif(text(A2:A8761,"mmmm"),"January",B2:B8761)
...
But I would like to know why sumif function does not work
...

If you check the help on SumIf(), you'll see:

[h=2]Syntax[/h]SUMIF(range, criteria, [sum_range])


You are not using a range as the first parameter.
 
Upvote 0
TEXT() returns a Text value, not a Range value, and so cannot be used as the first parameter of the SumIf() function.

Even I input Range in Text function like TEXT(A2:A8761,""), doesn't it return range output?

Thank you
 
Upvote 0
Even I input Range in Text function like TEXT(A2:A8761,""), doesn't it return range output?

Thank you


TEXT manipulates the range which is then fed to SUMIFS. The latter does not understand the TEXT result (not designed to understand such).
 
Upvote 0
Even I input Range in Text function like TEXT(A2:A8761,""), doesn't it return range output?

Yes, it returns the range output as text. That's not what SumIf() requires.

SumIf() requires the reference to the range.

Ex.:
A1:C1 have 1,2,3

SumIf(A1:C1,...,...) is OK, the parameter has a reference to the range

SumIf({1,2,3},...,...) does not work. The parameter has the values of the range, not the reference to the range
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

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