Calculate SUM based on date - excel

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))

Related

Excel, how to Sum on Column based on if the dates in another Column match the current month?

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())))

How do I write an excel formula to count the number of a value in one column based off of a date in another column?

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

How to retrieve specific information from a column and show its number of occurrences

I have a column which contains dates. I want to search this column and find the total entries for each month, and summarize the sum in a nice display. Example:
I want to display the number of times 'Disposition Verification Dates' occur in each month and summarize ("count") them in a format which follows:
I want to make several rows with the same concept in the same table for my other columns.
How do I do this? (PivotTables, VBA, IF statements?)
I would suggest adding a helper column which you can hide. See the formula in cell C1.
For the January column I used the following formula:
=COUNTIF($C$1:$C$7, 1)
February is:
=COUNTIF($C$1:$C$7, 2)
and so on. You can also use the YEAR function and convert the countif into a COUNTIFS function based on the other year helper column.
No VBA needed. No helper column needed. No Pivot Table needed.
In addition to Yaegz provided, and my comments, you can use an array formula.
Assuming your data is column A and you type Jan Feb Mar ... Dec into cells B1:N1, you can enter the following formula in cell B2.
=COUNT(IF(TEXT($A$2:$A$13,"mmm")=B$1,$A$2:$A$13))
Then press Ctrl + Shift + Enter (to make it work as an array) and you will have your summary done.

Excel: Find lowest value in range determined by a second column

I am trying to create a formula that will compare the value in one column and give the lowest value in another column.
For example if column A has a product code and column B has a price, how can I get column C to compare the values in column A to give the lowest stock price for each product code?
There's no MINIF (that's min if, not mini f) function (yet?), so back to the old days when one had to use array formulas before COUNTIF and SUMIF came about:
=MIN(IF($A$2:$A$8=A2,$B$2:$B$8)) in C2 and drag down. Be sure to enter as an array formula using Ctrl+Shift+Enter instead of just Enter

SUMIFS with date and name criteria... month and year only

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)

Resources