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
Related
What I'd like is to have a fill down formula that looks to see when the date value changes, and sum all the previous rows for that specific date.
For example, here's a spreadsheet:
In column J, you'll see that those values are the sums of each day. Those sums should only be displayed when the date changes, and the sums will just be the sums of each specific day. I think this has to require an array formula of some kind, but any suggestions? Thanks!
UPDATE
#Scott
I should mention that the dates aren't always the same length, meaning there could have been 2 rows on one date, and 6 on another date. They are sorted, but different number of rows. So it needs to also look backwards to see where the dates change as well...
I've used the formula provided in column K, and then filled it down. The expected answer is in the column just to the right of that.
Moving my comment to an answer because I believe this works, assuming your data is sorted by date, as Scott notes:
=IF(B2<>B3, SUMIF(B:B, B2, I:I), "")
This says if the next date is not equal to the current date, sum all values for that date. Otherwise leave the cell blank.
Edit: just noting for clarity based on the comments, the formula with the given row references assumes the table in question has a 1 row header, and the formula is written in row 2 and filled down. For this question the formula goes in J2 and is filled down. Also note that if you choose to reference a specific cell range instead of entire columns with B:B and I:I, the row references need to be anchored so they don't move when filled down, for example: =IF(B2<>B3, SUMIF(B$1:B$100, B2, I$1:I$100), "")
Update #OP was looking for a forumla based approach.
Well, if the dates are sorted then it can be done with following formula in row 2 beside the Net Units column.
=IF(B2<>B3, SUMIF ($B$2:$I$50, B2, $I$2:$I$50), "")
The row numbers and columns letter should be changed to reflect the data to be selected. Missing the $ (absolute reference) will break the formula.
sumif (range, criteria, sum_range)
// Range is you area from criteria column till the sum_range column, and sum_range is the column that has numerical value to be added.
This kind of problem is best solved by using Pivot Tables. Select your data, make sure each column name/field is unique and then proceed as follows:
Go to Menu > Insert > Pivot Table
Select the cells or worksheet (new worksheet preferred) where you want the Pivot Table to be created.
In the PivotTable builder select, your Date column to Rows
Select the columns that you want to be summed up and drag to the Values Filed
Adjust the Value Filed Settings (in the Values Field list (click the drop down arrow next to each field) to SUM function. [if needed]
Viola! This should produce the desired outcome and should be the preferred method.
I have a list of project IDs with start and end dates listed by the numbered day and month. (EX august =8, 1st =1) I have a calendar on another sheet with the month and day numbers in their own cells. I want the project ID to populate in the cell where the month and day numbers on the two sheets match.
Example = if A1 + A2 on Sheet1 Match A1 & A2 on Sheet2, Populate The Project ID here.
Can someone help me figure out the easiest way to do this?
If you have a data like this (in Sheet 1 for this example):
You can use this array formula (don't forget to press Ctrl+Shift+Enter) to populate the ID when the day and month number match:
=INDEX(Sheet1!$A$1:$A$6,MAX((A2=Sheet1!$B$2:$B$6)*(B2=Sheet1!$C$2:$C$6)*ROW(Sheet1!$B$2:$B$6)))
The brackets at the beginning and end of the formula is because it's an array formula.
I let you an example here: https://docs.google.com/spreadsheets/d/1xVmoZ8cGURuwnYF8AsLkozWUIxc5nPmt/edit?usp=sharing&ouid=109997475435544900987&rtpof=true&sd=true
I have a sheet (1) where header cells of columns hold week numbers and dates of mondays per every week.
Then i have another sheet (2) of reservations. I would need to create reservation view to sheet 1 where each cell of each resource row checks from sheet 2 if any day in current week hits any reservation from sheet 2 and return a number for that cell (for formatting purposes, number 1 in example below). There are multiple rows in sheet 2 for each unique resource, so i could not use VLOOKUP, since it returns only first occurrence.
Those numbers 1,2,3,4... in sheet 1 are ISO week numbers 1-53.
Sheet 1:
Sheet 2:
I've tried to approach this with IF/AND/VLOOKUP, but with no success...
=IF(AND(D$7>=VLOOKUP(B9;gantt_data!$A$3:$E$52;4;FALSE);D$7<=VLOOKUP(B9;gantt_data!$A$3:$E$52;5;FALSE);;);1;)
Thank you for help already!
You can try SUMPRODUCT function:
=IFERROR(1/SUMPRODUCT(($B4=$A$16:$A$24)*((DATEVALUE(C$2 & C$1)+7)>=$C$16:$C$24)*(DATEVALUE(C$2 & C$1)<$D$16:$D$24));"")
I believe a simple COUNIFS will do the job. Please try this formula. Paste it into your cell B9 of your table on Sheet1 and copy it from there to the right and down as required.
=COUNTIFS(Table1[Task Name],$A10,Table1[Reservation start],"<=" & B$7,Table1[Reservation end],">" & B$7+7)
Note that I presumed your Sheet2 to hold Table1. Please replace the range with another name if a range Table1 doesn't comprise of the DataBodyRange of your table on Sheet2. To avoid seeing all the zeroes please format the cells with the formula as Custom 0;;
I'm using Excel 2013:
I calculated when income/expense would fall on a given date in the year: Budget sheet on top, Event Calc sheet on bottom
On my "Budget Adjust" sheet, I then wanted to sum the amounts with the criteria of: 1) within two dates and 2) matching the income/expense type:
While I now understand that I can't use SUMIFS (because my data to sum and date criteria are different sizes), I'm wondering if any of you have a brilliant idea about how to sum the data for specific date ranges and a type match.
ADDITIONAL INFO: Using the data in the first few columns, I created a dynamic formula for each day in the year, so columns T:NV, with a day of the year in Row 1:
=IF($D2<>0,IF(AND(U$1>=$C2,(U$1-$C2)/$D2=ROUND(((U$1-$C2)/$D2),0)),$B2,0),IF(DAY(U$1)=$E2,$B2,0)).
For that day of the year, for the type of income/expense, it would enter either the income/expense that would fall on that day, or zero. There are 365 such columns (T:NV), one for each year.
My attempt was to use the range of data (T2:NV20) in one formula on the Budget Adjust sheet that would search for: 1) within a given date rage, and 2) for each Type, then return the Sum of the amounts found within that date range
--- EDIT ---
I want an elegant answer, with one formula in the results field, but here's how I've made it work:
I'm limited to two pics per post, so here is a pic of both sheets:
My work-around to get the answer
On top is is the Event Calc page, where I've created a column for each month, and H2 is highlighted with the formula above:
=SUMIFS($U2:$NV2,$U$1:$NV$1,">="&H$1,$U$1:$NV$1,"<"&I$1)
On the bottom is the Budget sheet with D9 (Salary for Jan-2016) highlighted:
using this formula:
=SUMIFS('Event Calc'!H$2:H$20,'Event Calc'!$A$2:$A$20,"="&$B9)
Why wouldn't you just use 'Event Calc' columns A, B and C? That is already in a proper format for a SUMIFS formula. On sheet "Budget Adjust" cell D17, use this formula:
=SUMIFS('Event Calc'!$B:$B,'Event Calc'!$A:$A,$B17,'Event Calc'!$C:$C,">="&D$10,'Event Calc'!$C:$C,"<="&D$11)
and then copy right and down
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.