I have a list that contains dates in M/DD/YYYY format.
In another sheet (see first image), i want to be able to calculate how many times a certain month appears in that list.
The formula i thought would work is
=COUNTIFS(*date range sheet&cells*,ISNUMBER(*date range sheet&cells*),*date range sheet&cells*,(MONTH(*date range sheet&cells*)=1))
In this case, the 1 would be for January, 2 for February and so on.
I am using a countifs because i have another if statement already worked out that i need to combine with this one: (*Date range sheet&another column*),"Loss")
Thank you all
With dates in column A, in C1 enter:
=SUMPRODUCT(--(MONTH($A$1:$A$27)=ROW()))
and copy down through C12:
C1 are the January countsC2 are the February countsetc.
Related
I am writing an excel formula for work. I have an updating sheet that counts for the month's output for each person. I want to keep track of how many days they have worked. by counting the unique dates they input into the sheet but only between the month dates placed on the master lookup form. ex
the month is 01/01/2019 - 01/01/ 2019 column a contains dates entered by employee cell e2 contains months beginning cell d2 contains months end found by eomonth. I want to search dates in column a for dates between e2 - d2 and output in e3 number of days worked.
=if(COUNTIFs(J3:J,J3:J&"",J3:J,">="&N2,J3:J,"<="&O2) = 0 ,"no days worked",SUMPRODUCT((J3:J<>"")/COUNTIFs(J3:J,J3:J&"",J3:J,">="&N2,J3:J,"<="&O2)))
is what I have so far. it keeps giving me the second part of sumproduct cannot be zero. but that formula is giving me 4 if used by itself based on the data set I am giving it. so I'm not sure where I am going wrong.
This is what I came up with.
=SUM(--(FREQUENCY(OFFSET(INDEX(Dates,IFERROR(MATCH(Dstart,Dates,0),MATCH(Dstart,Dates,1)+1)),0,0,COUNTIFS(Dates,">=" & Dstart, Dates,"<=" & Dend)),OFFSET(INDEX(Dates,IFERROR(MATCH(Dstart,Dates,0),MATCH(Dstart,Dates,1)+1)),0,0,COUNTIFS(Dates,">=" & Dstart, Dates,"<=" & Dend)))>0))
In a largely unsuccessful bid to make this formula more readable a created named ranges as follows.
Dstart = your D2
Dend = your E2
Dates = your J:J
You may replace the names with the addresses. However, I do not recommend the use of J:J because these 3 characters represent 1.4 million cells referenced repeatedly. If your data is of smaller size I recommend to stick with a named range for them and limit the size of that range somewhat.
Note that the formula is bloated because it counts unique values only. Its action, in a nutshell, is to find the first cell to match Dstart, then establish the last cell by counting how many entries there are and, finally, count unique items within that range.
I have a work sheet in which there are several cells with a specific entry - let's say "A". These are not all in the same rows/columns. After each cell is a date.
I need to count the number of cells containing "A" which also have a specific date in the cell immediately to its right. I've tried combinations of Countifs and Indirect, with no success. How can I achieve this?
This counts the number of times that there is A in column A and 1 in column B
=SUMPRODUCT(($A$1:$A$5="A")*($B$1:$B$5=1))
This outputs in cell D1
Not too difficult.
I have created a sample sheet with 8 rows and 5 columns of data.
See below, the formula in cell C12 counts the number of occurrences where the a cell with a date of October 31, 2017 is directly to the right of a cell that contains the text A.
If you want more info as to how this works, read on:
When searching for cells that contain A, you don't search in the last column of the data (in this case, column E) because it is impossible for a column to the right to have any date in it. This is why a portion of the formula says A1:D8="A" instead of A1:E8="A". This is the same reasoning why we start searching for a date in column B rather than column A in the formula.
You can achieve this with a helper row. Add additional row on top of your Worksheet. In cell "A1" enter formula below.
=COUNTIFS(A2:A2000,"A",B2:B2000,"YourDate")
Drag this formula to the rightmost of where you have data, then simply sum all values returned by formula.
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
Hello I am working with a formula that adds a range of cells after comparing dates. For example range A1:A5 has random dates within the year 2017, range B1:B5 each contain the number 10, cell C3 contains the word "OFF". Range A6:A371 begins with 1/1/17 and ends with 12/31/17. I would like a formula that adds the 10 onwards beginning on the date mentioned in A1:A5 but not if it says "OFF" from that date onwards. The formula I have to add them is
=SUMIF(A7,">="&$A$1,$B$1)+SUMIF(A7,">="&$A$2,$B$2)+SUMIF(A7,">="&$A$3,$B$3)+SUMIF(A7,">="&$A$4,$B$4)+SUMIF(A7,">="&$A$5,$B$5)
Is there a better formula and how can I have it not include the date that has "OFF" in column C? I hope I have explained the problem and goal well, if not please ask me to clarify further.
In B6 put:
=SUMIFS($B$1:$B$5,$A$1:$A$5,"<=" & A6,$C$1:$C$5,"<>OFF")
Then copy down the dataset
I am creating a spreadsheet with all my data on one sheet and metrics on the other.
On sheet 1 in cells A2:A50 I have the dates in this format (4/5/13). On sheet 2 in cell E5 I have April and I want it to total the number of PO's created in F5.
How can I do this?
I have tried using
=COUNTIF('2013'!$A$2:$A$50,'2013 Metrics'!E5).
I have a feeling that since my range is in 4/5/13 format and my criteria is April that won't work.
I was able to use this formula for total spend by month:
=SUM(IF(MONTH('2013'!$A$2:$A$19)=4,'2013'!$D$2:$D$19,0))
but not luck with how many PO's by month.
Use a pivot table. You can manually refresh a pivot table's data source by right-clicking on it and clicking refresh. Otherwise you can set up a worksheet_change macro - or just a refresh button. Pivot Table tutorial is here: http://chandoo.org/wp/2009/08/19/excel-pivot-tables-tutorial/
1) Create a Month column from your Date column (e.g. =TEXT(B2,"MMM") )
2) Create a Year column from your Date column (e.g. =TEXT(B2,"YYYY") )
3) Add a Count column, with "1" for each value
4) Create a Pivot table with the fields, Count, Month and Year
5) Drag the Year and Month fields into Row Labels. Ensure that Year is above month so your Pivot table first groups by year, then by month
6) Drag the Count field into Values to create a Count of Count
There are better tutorials I'm sure just google/bing "pivot table tutorial".
For anyone finding this post through Google (as I did) here's the correct formula for cell F5 in the above example:
=SUMPRODUCT((MONTH(Sheet1!$A$1:$A$50)=MONTH(DATEVALUE(E5&" 1")))*(Sheet1!$A$1:$A$50<>""))
Formula assumes a list of dates in Sheet1!A1:A50 and a month name or abbr ("April" or "Apr") in cell E5.
Make column B in sheet1 the dates but where the day of the month is always the first day of the month, e.g. in B2 put =DATE(YEAR(A2),MONTH(A2),1). Then make E5 on sheet 2 contain the first date of the month you need, e.g. Date(2013,4,1). After that, putting in F5 COUNTIF(Sheet1!B2:B50, E5) will give you the count for the month specified in E5.
I would add another column on the data sheet with equation =month(A2), then run the countif on that column... If you still wanted to use text month('APRIL'), you would need a lookup table to reference the name to the month number. Otherwise, just use 4 instead of April on your metric sheet.
use count instead of sum in your original formula u will get your result
Original One
=SUM(IF(MONTH('2013'!$A$2:$A$19)=4,'2013'!$D$2:$D$19,0))
Modified One
=COUNT(IF(MONTH('2013'!$A$2:$A$19)=4,'2013'!$D$2:$D$19,0))
AND USE ctrl+shift+enter TO EXECUTE
Recommend you use FREQUENCY rather than using COUNTIF.
In your front sheet; enter 01/04/2014 into E5, 01/05/2014 into E6 etc.
Select the range of adjacent cells you want to populate. Enter:
=FREQUENCY(2013!!$A$2:$A$50,'2013 Metrics'!E5:EN)
(where N is the final row reference in your range)
Hit Ctrl + Shift + Enter
Sooooo, I had this same question. here's my answer: COUNTIFS(sheet1!$A:$A,">="&D1,sheet1!$A:$A,"<="&D2)
you don't need to specify A2:A50, unless there are dates beyond row 50 that you wish to exclude. this is cleaner in the sense that you don't have to go back and adjust the rows as more PO data comes in on sheet1.
also, the reference to D1 and D2 are start and end dates (respectively) for each month. On sheet2, you could have a hidden column that translates April to 4/1/2014, May into 5/1/2014, etc. THen, D1 would reference the cell that contains 4/1/2014, and D2 would reference the cell that contains 5/1/2014.
if you want to sum, it works the same way, except that the first argument is the sum array (column or row) and then the rest of the ranges/arrays and arguments are the same as the countifs formula.
btw-this works in excel AND google sheets. cheers