I am trying to get a SUMIFS formula to check a column of dates and sum only the values that correspond to the matching year and month of the criterion date. I would also like this SUMIFS to include a name criterion along with the date. i.e.
Cell A1: =SUMIFS('Sheet1'!O:O, 'Sheet1'!D:D, 'Sheet2'!DATE(B2), 'Sheet1'!E:E, "Name")
sheet1 column O is where the sum values are stored
sheet1 column D is where the date values are stored
sheet2 cell B2 is where the date comparison criterion is stored
sheet1 column E is where the names are stored
"Name" is the name criterion that I want for sum selection
Any insight will be most appreciated!
You can use SUMIFS if you create a start and end date for your dates, i.e. with this version
=SUMIFS('Sheet1'!O:O,'Sheet1'!D:D, ">="&EOMONTH('Sheet2'!B2,-1)+1, 'Sheet1'!D:D, "<"&EOMONTH('Sheet2'!B2,0)+1, 'Sheet1'!E:E, "Name")
EOMONTH is used to get the start and end dates of the relevant month then your SUMIFS sums the correct values based on your other criteria.
If B2 is guaranteed to be the first of the month you can omit the first EOMONTH function
Solution with SUMPRODUCT
I find it simpler to use SUMPRODUCT in situations like this.
For no header row you can simple use:
=SUMPRODUCT((MONTH(Sheet1!D:D)=MONTH(Sheet2!$B$2))*(YEAR(Sheet1!D:D)=YEAR(Sheet2!$B$2))*(Sheet1!E:E="Name"),Sheet1!O:O)
Just replace "Name" with what you want.
If you have a header row (or if the column contains any values that are not valid dates) you need to use an array formula within SUMPRODUCT:
=SUMPRODUCT((IF(ISERROR(MONTH(Sheet1!D:D)),Sheet1!D:D,MONTH(Sheet1!D:D))=MONTH(Sheet2!$B$2))*(IF(ISERROR(YEAR(Sheet1!D:D)),Sheet1!D:D,YEAR(Sheet1!D:D))=YEAR(Sheet2!$B$2))*(Sheet1!E:E="Name"),Sheet1!O:O)
(Array formulas are entered using ctrl + shft + enter)
Related
I need to find the sum of the cells in a Column if their end dates in another column occur in the current month.
I tried using the formula =sumif(L:L,MONTH(TODAY()),J:J) but it doesn't work.
Column L contains the full date (ex: 12/1/18).
Column J contains the values I want to add up.
So since it's December, I want to add all the values in J that have a date that is in December, and so on a so forth when I use the sheet in January.
Try this formula:
=SUM(IF(MONTH(L:L)=MONTH(TODAY()),J:J,0))
and enter it with Ctrl-Shift-Enter as it is an array formula.
Or use =SUMPRODUCT((J:J)*(MONTH(L:L)=MONTH(TODAY())))
I have a worksheet and I'm trying to do a simple Count function, probably a countif but I'm unsure how to go about writing the formula.
I have two columns that I'd like to use for this formula.
Column N - I would like to filter for the Criteria of "C" or anytime a cell has a value of C
Column 0 - This column has dates filled in (short date format).
I would like to get a count of every C for each month, as simple as that.
In this example I filtered the date for May of 2017 and filtered for C under the Check column. We can see that there are 12 instances of C showing in the month of May 2017.
Does anyone know how to structure a formula that I would be able to Count the Number of C's for every month into the foreseeable future?
I figured out how to count the total present in a date range but unsure of how to add the date range plus Column N (Check) every time "C" is present in the cell.
=SUMPRODUCT((O:O>=DATEVALUE("5/1/2017"))*(O:O<=DATEVALUE("5/31/2017")))
Try this
=COUNTIFS(O1:O100,">="&A1,O1:O100,"<"&B1,N1:N100,"C")
Where A1 has the start date and B1 has the end date for that month. You can use DATEVALUE() instead of A1 and B1. Change as applicable
Screenshot
If you want to use SUMPRODUCT then see this
=SUMPRODUCT((O:O>=DATEVALUE("1/5/2017"))*(O:O<=DATEVALUE("30/5/2017"))*(N:N="C"))
In another column (lets say 'P' for example) I would insert a formula to give you the month number =Month(P7) - this will return 5 for May.
I would then use COUNTIFS (Like COUNTIF but it uses multiple criteria) to count where column N contains 'C' and column 'P' contains '5'.
=COUNTIFS(N:N,"C",P:P,5)
Try this....you need to select the entire Column B and named the column as 'Date'.enter image description here
This is driving me nuts and I don't know what I'm doing wrong.
I have an excel table where my turnover is in with the date of incoming invoices. The date is in format ddmmjjj and is in column C.
I want to calculate my turnover on my dashboard. The total turnover is in column G.
The formula I use is:
=SUM(IF(MONTH(Sheet1!C:C)=2;Sheet!G:G;))
But this formula keeps giving me the total turnover... What am I doing wrong?
You need to use the SUMIF function in Excel, which allows you to sum up certain cells if the values in associated cells match a criteria:
SUMIF(range, criteria, [sum_range])
In your case, you'd want to extract the month for the dates in column C into another column (say column X holds the month for the dates in column C), and then:
=SUMIF(Sheet1!X:X, 2, Sheet1!G:G)
The formula you are using is correct, however you need to enter it as an array formula (via Ctrl + Shift + Enter).
=SUM(IF(MONTH(Sheet1!C:C)=2,Sheet1!G:G,0))
I have two columns, the first is a date column and the second references the first column cell next to and formats it as a day name.
I would now like to count how many Mondays, Tuesdays and so on are in the second column so it looks like the outlined box in the image. I have tried COUNTIF but that doesn't appear to work, presumably because the second column is a formatted value and not text.
How can I achieve what I'm after?
Excel cells
You can achieve that with an array formula. Just enter the following formula:
{=SUM(IF(WEEKDAY($A$1:$A$10)=2,1,0))}
Here is an example to illustrate the above formula:
The above formula assumes (as illustrated in the sample GIF) that you have the range of dates in column A from row 1 through 10. For each weekday you will have to adjust the formula for the correct week-day number: Monday = 2, Tuesday = 3, etc. COUNTIF will not work.
I am going to assume the dates are in column "A" and weekdays in column "B"
for example, cells A1 and B1
If you are having trouble column "B" being number and just displaying it as "Tuesday",
try changing column "B" formula to below instead of changing format to "DDDD"
=TEXT(A1,"DDDD")
This will change Column "B" to a text, and countif function will work
=COUNTIFS($C$2:$C$20000,MONTH(8),$K$2:$K$20000,"U")
Where C column is the list of dates, K column is another criteria i want to meet.
Here I'm attempting to count whenever Column C is within the month of August and Column K value is "U", the above formula i used return 0 where I expecting some values.
Not sure what is the problem with my formula.
Month() formula won't work inside COUNTIFS formula, you can use SUMPRODUCT instead:
=SUMPRODUCT((MONTH($C$2:$C$20000)=8)*($K$2:$K$20000="U"))
Or add an extra column to your data, calculate month in it, and use COUNTIFS with the new column.