SUMIFS with DATE criteria (match only year and month)











up vote
0
down vote

favorite












The data I am working with is daily, whereas the data I am importing values from is monthly.



I used SUMIFS and wanted to set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month.
It only returns 0's so far.



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,DATE(YEAR($A2),MONTH($A2),1))/(DATE(YEAR($A2),MONTH($A2)+1,1)-DATE(YEAR($A2),MONTH($A2),1))









share|improve this question
























  • I don't know the answer, but I feel that the question is "How do I set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month?"
    – RichardBJ
    Nov 11 at 14:48










  • Thank you @RichardBJ yes that's what I meant :D
    – user10093163
    Nov 12 at 5:54















up vote
0
down vote

favorite












The data I am working with is daily, whereas the data I am importing values from is monthly.



I used SUMIFS and wanted to set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month.
It only returns 0's so far.



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,DATE(YEAR($A2),MONTH($A2),1))/(DATE(YEAR($A2),MONTH($A2)+1,1)-DATE(YEAR($A2),MONTH($A2),1))









share|improve this question
























  • I don't know the answer, but I feel that the question is "How do I set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month?"
    – RichardBJ
    Nov 11 at 14:48










  • Thank you @RichardBJ yes that's what I meant :D
    – user10093163
    Nov 12 at 5:54













up vote
0
down vote

favorite









up vote
0
down vote

favorite











The data I am working with is daily, whereas the data I am importing values from is monthly.



I used SUMIFS and wanted to set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month.
It only returns 0's so far.



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,DATE(YEAR($A2),MONTH($A2),1))/(DATE(YEAR($A2),MONTH($A2)+1,1)-DATE(YEAR($A2),MONTH($A2),1))









share|improve this question















The data I am working with is daily, whereas the data I am importing values from is monthly.



I used SUMIFS and wanted to set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month.
It only returns 0's so far.



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,DATE(YEAR($A2),MONTH($A2),1))/(DATE(YEAR($A2),MONTH($A2)+1,1)-DATE(YEAR($A2),MONTH($A2),1))






excel date sumifs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 4:54

























asked Nov 11 at 13:53







user10093163



















  • I don't know the answer, but I feel that the question is "How do I set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month?"
    – RichardBJ
    Nov 11 at 14:48










  • Thank you @RichardBJ yes that's what I meant :D
    – user10093163
    Nov 12 at 5:54


















  • I don't know the answer, but I feel that the question is "How do I set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month?"
    – RichardBJ
    Nov 11 at 14:48










  • Thank you @RichardBJ yes that's what I meant :D
    – user10093163
    Nov 12 at 5:54
















I don't know the answer, but I feel that the question is "How do I set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month?"
– RichardBJ
Nov 11 at 14:48




I don't know the answer, but I feel that the question is "How do I set criteria as YEAR & MONTH only. So that in the daily table, it returns the same value for 30/31 days of the corresponding month?"
– RichardBJ
Nov 11 at 14:48












Thank you @RichardBJ yes that's what I meant :D
– user10093163
Nov 12 at 5:54




Thank you @RichardBJ yes that's what I meant :D
– user10093163
Nov 12 at 5:54












1 Answer
1






active

oldest

votes

















up vote
0
down vote













The problem you have is that you can't change the format of each individual cell in the range that you want to interrogate but you can test if each date in that range falls within a certain date range ( greater than or less than)
So, if the value in cell A2 is the first of the month 1st October 2018 for example then you can use



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2, 'EA-04'!$A:$A,”<”&EDATE($A2,1))


The formula says less than or equal to 1st October 2018 or less that 1st of November 2018



The EDATE(date,1) function adds 1 calendar month to the date in A2 so the 1st of the month becomes the first of the next month regardless of the number of days in the source month.



If the value in cell A2 is not the 1st then you can use this formula to change it to the 1st



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2-(day($A2))+1, 'EA-04'!$A:$A,”<”&EDATE($A2-(day($A2))+1,1))





share|improve this answer





















  • Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
    – user10093163
    Nov 12 at 5:50










  • I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
    – user10093163
    Nov 12 at 5:52










  • Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
    – user10093163
    Nov 12 at 5:59










  • it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
    – Gordon
    Nov 15 at 1:43











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249426%2fsumifs-with-date-criteria-match-only-year-and-month%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













The problem you have is that you can't change the format of each individual cell in the range that you want to interrogate but you can test if each date in that range falls within a certain date range ( greater than or less than)
So, if the value in cell A2 is the first of the month 1st October 2018 for example then you can use



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2, 'EA-04'!$A:$A,”<”&EDATE($A2,1))


The formula says less than or equal to 1st October 2018 or less that 1st of November 2018



The EDATE(date,1) function adds 1 calendar month to the date in A2 so the 1st of the month becomes the first of the next month regardless of the number of days in the source month.



If the value in cell A2 is not the 1st then you can use this formula to change it to the 1st



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2-(day($A2))+1, 'EA-04'!$A:$A,”<”&EDATE($A2-(day($A2))+1,1))





share|improve this answer





















  • Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
    – user10093163
    Nov 12 at 5:50










  • I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
    – user10093163
    Nov 12 at 5:52










  • Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
    – user10093163
    Nov 12 at 5:59










  • it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
    – Gordon
    Nov 15 at 1:43















up vote
0
down vote













The problem you have is that you can't change the format of each individual cell in the range that you want to interrogate but you can test if each date in that range falls within a certain date range ( greater than or less than)
So, if the value in cell A2 is the first of the month 1st October 2018 for example then you can use



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2, 'EA-04'!$A:$A,”<”&EDATE($A2,1))


The formula says less than or equal to 1st October 2018 or less that 1st of November 2018



The EDATE(date,1) function adds 1 calendar month to the date in A2 so the 1st of the month becomes the first of the next month regardless of the number of days in the source month.



If the value in cell A2 is not the 1st then you can use this formula to change it to the 1st



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2-(day($A2))+1, 'EA-04'!$A:$A,”<”&EDATE($A2-(day($A2))+1,1))





share|improve this answer





















  • Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
    – user10093163
    Nov 12 at 5:50










  • I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
    – user10093163
    Nov 12 at 5:52










  • Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
    – user10093163
    Nov 12 at 5:59










  • it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
    – Gordon
    Nov 15 at 1:43













up vote
0
down vote










up vote
0
down vote









The problem you have is that you can't change the format of each individual cell in the range that you want to interrogate but you can test if each date in that range falls within a certain date range ( greater than or less than)
So, if the value in cell A2 is the first of the month 1st October 2018 for example then you can use



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2, 'EA-04'!$A:$A,”<”&EDATE($A2,1))


The formula says less than or equal to 1st October 2018 or less that 1st of November 2018



The EDATE(date,1) function adds 1 calendar month to the date in A2 so the 1st of the month becomes the first of the next month regardless of the number of days in the source month.



If the value in cell A2 is not the 1st then you can use this formula to change it to the 1st



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2-(day($A2))+1, 'EA-04'!$A:$A,”<”&EDATE($A2-(day($A2))+1,1))





share|improve this answer












The problem you have is that you can't change the format of each individual cell in the range that you want to interrogate but you can test if each date in that range falls within a certain date range ( greater than or less than)
So, if the value in cell A2 is the first of the month 1st October 2018 for example then you can use



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2, 'EA-04'!$A:$A,”<”&EDATE($A2,1))


The formula says less than or equal to 1st October 2018 or less that 1st of November 2018



The EDATE(date,1) function adds 1 calendar month to the date in A2 so the 1st of the month becomes the first of the next month regardless of the number of days in the source month.



If the value in cell A2 is not the 1st then you can use this formula to change it to the 1st



=SUMIFS('EA-04'!$D:$D,'EA-04'!$A:$A,”>=”&$A2-(day($A2))+1, 'EA-04'!$A:$A,”<”&EDATE($A2-(day($A2))+1,1))






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 20:00









Gordon

1,0151611




1,0151611












  • Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
    – user10093163
    Nov 12 at 5:50










  • I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
    – user10093163
    Nov 12 at 5:52










  • Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
    – user10093163
    Nov 12 at 5:59










  • it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
    – Gordon
    Nov 15 at 1:43


















  • Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
    – user10093163
    Nov 12 at 5:50










  • I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
    – user10093163
    Nov 12 at 5:52










  • Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
    – user10093163
    Nov 12 at 5:59










  • it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
    – Gordon
    Nov 15 at 1:43
















Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
– user10093163
Nov 12 at 5:50




Hi! The value in A2 is 31/12/2001, the column it's in is daily. I tried both formulas you gave and it still returns 0.
– user10093163
Nov 12 at 5:50












I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
– user10093163
Nov 12 at 5:52




I also tried setting the criteria as AND(MONTH($A2)=MONTH('EA-04'!$A2),YEAR($A2)=YEAR('EA-04'!$A2). but it also does not work.
– user10093163
Nov 12 at 5:52












Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
– user10093163
Nov 12 at 5:59




Sorry, forgot to mention: The criteria range is monthly, with the day being last day of the month.
– user10093163
Nov 12 at 5:59












it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
– Gordon
Nov 15 at 1:43




it should work as it's checking the whole month. Check that the dates you have listed are stored in date format and not text.
– Gordon
Nov 15 at 1:43


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249426%2fsumifs-with-date-criteria-match-only-year-and-month%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python