excel 2010 Count IF value and date meet condition - excel

Hi look at some topics here could not find one that meets what I need to do.
I have a SharePoint list which I open in Excel(2010) in SharePoint I have created a calculated field that counts how days have passed between to dates. in excel these columns are "M" and "N". My calculated column in excel is "T"
This made the calculation in excel simple.
which calculate how many days have passed that is less than 6 (days).
=COUNTIF(Data!$T:$T,"<"& 6)
This give me overall calculation for 12 months. What I need to do is break it down per months.
for example: how many days pass that is less than 6 in Nov. my date column "M" so I tried
=COUNTIF(Data!$T:$T,"<"&6&"AND"& TEXT(Data!$M:$M,"mmm") = "Nov")
This give me a count of zero which I know is not correct. so I was wondering what the best way to add the second columns criteria ?

Try this
=SUMPRODUCT((TEXT(Data!$M:$M,"mmm")="Nov")*(Data!$T:$T<6))

As you have Excel 2010, you can use the more powerful COUNTIFS
=COUNTIFS(Data!$T:$T,"<6",Data!$M:$M,">="&DATE(2013,11,1),Data!$M:$M,"<"&DATE(2013,12,1))
The DATE calculation can also reference cells, so you could change the count to this: (split into lines for readability)
=COUNTIFS(Data!$T:$T,"<6",
Data!$M:$M,">="&DATE(2013,MonthCell,1),
Data!$M:$M,"<"&DATE(2013,MonthCell+1,1))

Related

Excel - Get unique count based on multiple columns (including date)

I'm trying to get a unique count of data in Column B that fall into the month of June (Column A date field)
Screenshot of Spreadsheet
I highlighted the rows that fall within June in Orange and the duplicate data in red to make it easier to view.
Count Total formula is a simple:
=COUNTA(A:A)-1
Unique Data formula is:
=SUMPRODUCT(1/COUNTIF(B2:B21,B2:B21))
Count June formula is:
=COUNTIFS(A:A,">=01/06/2020",A:A,"<30/6/2020")
But I can't figure out how get a count of unique data that falls within June (expected result is 13)
I've tried filter/unique formulas based on
Excel - Count unique values that meets multiple criteria
But I just can't get it to work. I know I could do it with VBA but this is part of a larger spreadsheet and every other part of the spreadsheet I've been able to do with Formulas, so would like to be able to do this last part with formulas too.
Anyone can help will be a life saver, it's been driving me nuts for the last couple hours.
In Excel 2016, which does not have the UNIQUE or FILTER functions, you can use this somewhat convoluted formula for a Unique count of June entries:
=SUM(IF(FREQUENCY(IF(LEN(IF(MONTH(Table1[Date])=6,Table1[Data],""))>0,MATCH(IF(MONTH(Table1[Date])=6,Table1[Data],""),IF(MONTH(Table1[Date])=6,Table1[Data],""),0),""),IF(LEN(IF(MONTH(Table1[Date])=6,Table1[Data],""))>0,MATCH(IF(MONTH(Table1[Date])=6,Table1[Data],""),IF(MONTH(Table1[Date])=6,Table1[Data],""),0),""))>0,1))
This part of the formula: IF(MONTH(Table1[Date])=6,Table1[Data],"") returns an array consisting of all of the June Data entries.
The LEN(... eliminates the resultant blanks
The Frequency function will then have us wind up with a count of 1 for each entry.
Then we just add it up.
Note that I used a Table and structured references, but you can convert it to regular addressing if you need to.
Of course, if you had Excel O365, you could use the simpler:
=COUNTA(UNIQUE(FILTER(Table1[Data],MONTH(Table1[Date])=6)))

Comparing Month with date(MM/DD/YR)

Is it possible to compare a month number with a date(MM/DD/YR) in Excel/Google Sheets?
For example, according to the screenshot, I just want to calculate the weekly time only in September and not August. I want it to be general so whatever month I choose, it will only calculate the hours for that month and not other months that is displayed on the table. I think the way to approach the problem is writing an if statement where if the DATE column starts with "9", then it will only calculate that row, and ignore the other rows that is not a 9.
I am just not sure if we can compare multiple cells to see if it matches with a certain month.
all you need is:
=SUM(FILTER(B1:B7, MONTH(A1:A7)=8))
You could use SUMIFS in both Excel or Google Sheets:
=SUMIFS(E2:E8,A2:A8,">="&F10,A2:A8,"<="&EOMONTH(F10,0))
Adjust ranges (and make them absolute if need be)

How do I sum a total number of occurrences of a ID number with a specific month and year in Excel

I have a Excel Master sheet where I am looking to query other sheets within the workbook. What I am trying to do is see How many occurrences of an ID for a Project in a column occur within a month, e.g. how many times does the ID 1367 occur in November. My dates are in the format of e.g 13/11/18 and this cannot be changed as I am just creating a report against a workbook I do not own.
The relevant columns I need are formatted like so:
Project: Project ID: Date:
a 123 1/01/2018
a 123 2/01/2019
a 123 3/01/2018
a 123
This is my SUMIFS function:
=SUMIF(PPlanner!$D:$D,Dashboard!$B$6,PPlanner!X:X)
This works by itself. My problem is trying to get the ID total for a specific month.
It returns the number of occurrences the ID occurs against a project all together but not against the month specifically. I have tried adding syntax to specify
the month but I am getting errors such as "too many arguments".
I recently answered a question that was very similar :
Excel - Take Average of Monthly Data
I think this would answer your question as well, but you have to use COUNTIFS instead of AVERAGEIFS
As for presentation, I would make a separate list of the months you want to include, and put the formula next to it, instead of the formula next to the actual list of data (as in the other question). As for how to write/input the month, you can put it any way you want, as long as it is a valid date in Excel. With the cell formatting you then can show it as month and year only. This is just to say that a text input JANUARY 2018 does not work (in a normal cell, eg. a cell that you did not format as text, when you type that into the cell, Excel recognizes this as a date, and will actually put 1/1/2018).
Oh, and using a Pivot table would work as well, the other answer on the question referenced above also explains how to do that.
In some cases, how Excel handles dates is very convenient.
For you, the date format doesn't matter. It is simply a number counting days with 0 being December 31st, 1899.
13/11/18 the date is the integer 43417 in-cell value. Excel interprets this as a both date and time together. The whole numbers are the days while the decimals are the time of day as a fraction of the day. 43417.5 would be noon.
So you may use COUNTIFS to help here.
=COUNTIFS(PPlanner!$X:$X, 1367, PPlanner!$D:$D, ">"&43404, PPlanner!$D:$D, "<"&43435)
This is going to look at sheet PPlanner column X and count how many instances of 1367 occur after the last day of October and before the first day of December. There are other ways to accomplish this, but it allows you to count within any date range you want.

Countif with dates does not work

I couldn't find a similar question that's why I asked a new one.
I have a worksheet with two columns - first column shows month and year in the following format "mon.year", for example "apr.2017" and the second one shows a number. The number must represent the count of some other dates filtered by specific criteria. I have those dates in another sheet - one column with name and one with a date.
What I want to do is count the number of dates for example from june 2017 from the second sheet and place the number in the second column in the first sheet.
Here is how the first sheet looks like:
And this is how the second sheet with data looks like:
The result I'm looking for is this:
So, I tried the following code but I can't figure out why it doesn't work.
Any suggestions how to improve the formula?
EDIT: So, both the comments below were helpful for me but as the formula had to be simplified at most (my colleagues work with the excel file, not me) I chose to calculate the month and year in two hidden columns, then use the countif formula on them.
You will need to bracket the dates:
=COUNTIFS('1'$B$2:$B$26,">=" & EOMONTH(A2,-1)+1,'1'$B$2:$B$26, "<" & EOMONTH(A2,0)+1)
For Excel, a date/time is just a formatted number, the number of days since a fixed epoch.
"="&MONTH(A2) is an expression which concatenates the string = with the result of the function MONTH(A2), which is 1. The result of the expression is =1, which is what COUNTIFS sees.
You're actually telling COUNTIFS to match the date/time whose serial number is 1 (December 31, 1999 at midnight). Similarly, the second criteria will match exactly on July 9, 1905 at midnight.
My suggestion for you is to compute the month and year of each date on separate columns, and use COUNTIFS on these columns.

Calculation of two cells in a COUNTIF

I have an Excel document with two date columns and a column with four possible values. I need to filter for one value on the last column. Then I need to calculate the days between the two dates for all the values that are left and count the times that those days are between 0 and 30.
I know how to filter and I know how to calculate the days between two dates. I also know how to count the times those days are between 0 and 30.
I cannot figure out how to put it all together without making a simple calculation in another sheet and hide it.
No longer needed. I found out how to pull the data from Google Analytics with some VBA code.

Resources