Multiple criteria to sum a range of data - excel

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

Related

How to count and then vlookup?

I have two spreadsheets and I want to sum up the total and then vlookup but when I do it I get 0 as a result.
Basically I have all 12 weeks, so I want to sum up all the numbers for "week 1" then vlookup the total to the other spreadsheet. the spreadsheet I want to sup up, so 7x10 = 70
the overview spreadsheet I want to get the "70" from week 1
You don't need a Vlookup, because you have many values for week 1, and no identifier for the week 1 total. Instead, on the summary sheet, you can use a Sumif() or Sumifs() function. Something along the lines of this:
=Sumifs(Sheet1!C:C,Sheet1!A:A,Sheet2!A3)
In words: Sum up all the values from Sheet1 in column C where column A in Sheet1 has the same value as cell A3 on Sheet2.
You need to adjust the sheet names and cell references to reflect your workbook.
With that approach, you do not need to enter weekly totals into your first sheet at all. It's not good practice to interrupt a table of data entry cells with formulas. It's better to do the reporting and analysis outside of the data entry table.

How to get data values from sheet. In this week comparison in excel. Using Vlook or?

2 cells with =TODAY()-WEEKDAY(TODAY())+1 and =TODAY()-WEEKDAY(TODAY())+7. One for this week first day and the other one for the last day of the week. How to get data from this week. Am I going to use VLOOKUP? or something formula. Thanks
I am trying return data that matches these dates. For example on the other sheet i do have date 5/29/2018,5/27/2018 ,4/27/2018 and has data values , and on the other sheet i created summary for data where this week from the first day of the week today to last day of the week today 5/27/2018- 6/2/2018 where those data will be the output the data of 5/29/2018,5/27/2018
These are the dates that i will get from 5/27/2018 - 6/2/2018
enter image description here
FROM THE DATA HERE
enter image description here
I will get the PRF Control # from the dates that will pass through 5/27/2018- 6/2/2018
Sounds like you may be after an index match.
This is the formula in the summary sheet cell B4 and then dragged down for 7 rows to cover selected week:
=IFERROR(INDEX(Sheet1!A:A,MATCH(A4,Sheet1!$C:$C,0)),"")
Summary sheet has the two cells (B2 and C2) which determine the week dates to match on or between.
Summary sheet
The data sheet (sheet1) which is referenced by the formulas:
The formula attempts to match the dates in summary sheet, with Match function, and uses the position number returned as the row number to Index, which then pulls the PRF Control # in the same row.

How to count number of records active in all dates in Excel? [duplicate]

I have a sheet of trainings in excel that are organized by date and I am trying to do a monthly statistics report. So, I want to count, through an excel formula, the number of trainings that were done in the month that is specified in the header of the statistics column. The header has the month in number format and the dates in the training sheet are in 01/23/2015 format. For example, if the header of the stat column was "1" I would want to count all the trainings that were done in January 2015. Any help with this issue would be greatly appreciated!
If the dates of the exercises are in format mm/dd/yyyy I would suggest making a new column (in column B) for the month and a new column (in column C) for the year
The formula for extracting months from a column is
=TEXT(A1,"mmmm")
The formula for extracting years is
=YEAR(A1)
Add these formulas to columns B and C and now you can use the filters in excel to show only training exercises from the year and month you want. I think the filters are the best way to view the exercises you want and it is easy to get counts from these looking at the number of rows in the filter table.
However, if you want to show the number of exercises that occurred in a certain month/year you can write an if statement that will give a value of 1 if your criteria is matched and a value of 0 if the criteria is not matched. This will look something like this:
=IF(B1="January",1,0)
This will check if the month in column B is "January", then return the value 1 if it is "January". If it is not January, it will return 0.
To see the number of times a year appears use:
=IF(C1=2015,1,0)
This will check if the year in column C is 2015, than return the value 1. If it is not January, return 0.
Add these formulas to columns D and E.
Then sum the values in this column
=SUM(D1:D1000)
for month, and
=SUM(E1:E1000)
for year, and you will get the number of reports that matches your criteria. This is one way you can use Excel formulas to obtain the number of exercises in a certain month or year. If you have more than 1000 reports just change the number to 10,000 or more.
Hope this helps!
With the "header of the stat column" as A1 and the training dates in A2:A999 you could use,
=countifs(a2:index(a:a, match(1e99, a:a)), ">="&date(2015, a1, 1), a2:index(a:a, match(1e99, a:a)), "<"&edate(date(2015, a1, 1), 1))

Count all records from certain month in excel

I have a sheet of trainings in excel that are organized by date and I am trying to do a monthly statistics report. So, I want to count, through an excel formula, the number of trainings that were done in the month that is specified in the header of the statistics column. The header has the month in number format and the dates in the training sheet are in 01/23/2015 format. For example, if the header of the stat column was "1" I would want to count all the trainings that were done in January 2015. Any help with this issue would be greatly appreciated!
If the dates of the exercises are in format mm/dd/yyyy I would suggest making a new column (in column B) for the month and a new column (in column C) for the year
The formula for extracting months from a column is
=TEXT(A1,"mmmm")
The formula for extracting years is
=YEAR(A1)
Add these formulas to columns B and C and now you can use the filters in excel to show only training exercises from the year and month you want. I think the filters are the best way to view the exercises you want and it is easy to get counts from these looking at the number of rows in the filter table.
However, if you want to show the number of exercises that occurred in a certain month/year you can write an if statement that will give a value of 1 if your criteria is matched and a value of 0 if the criteria is not matched. This will look something like this:
=IF(B1="January",1,0)
This will check if the month in column B is "January", then return the value 1 if it is "January". If it is not January, it will return 0.
To see the number of times a year appears use:
=IF(C1=2015,1,0)
This will check if the year in column C is 2015, than return the value 1. If it is not January, return 0.
Add these formulas to columns D and E.
Then sum the values in this column
=SUM(D1:D1000)
for month, and
=SUM(E1:E1000)
for year, and you will get the number of reports that matches your criteria. This is one way you can use Excel formulas to obtain the number of exercises in a certain month or year. If you have more than 1000 reports just change the number to 10,000 or more.
Hope this helps!
With the "header of the stat column" as A1 and the training dates in A2:A999 you could use,
=countifs(a2:index(a:a, match(1e99, a:a)), ">="&date(2015, a1, 1), a2:index(a:a, match(1e99, a:a)), "<"&edate(date(2015, a1, 1), 1))

Count number of occurrences by month

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

Resources