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))
Related
I have a table with 2 columns : dates (1st of the month) and values. Each date can appear an unknown number of time. I am trying to find a formula that would make a yearly average of the sum of the value for each month.
I can easily make several sumproducts to have the sum of values for each month and then average but I would prefer to limit the size of the formula.
Does anyone has an idea on how to do that, or if that's even possible?
I assume that dates are in A column and values in B column.
The easiest way would be:
1) In third column (C), store the integers indicating the month. You will get this result by simple =MONTH() Excel function, ex.: =MONTH(A1), etc.
2) To get the average from particular month, say September (9th month), you need to enter the formula:
= SUMIF(C:C,"=9",B:B)/COUNTIF(C:C,"=9")
If you want the average for different month, you just change the 9 in SUMIF and COUNTIF.
You could make a pivot table, then drag the date in row field and values in value field. Then change the field setting of the values to 'average'.
I'm trying to summarize 2 years worth of data quickly by month. What I want to do is to average only the values from Monday to Friday for each month.
If you change column b to be a calculated day of week field like so:
=TEXT(B2, "ddd")
And you insert a new column c field that is calculated month like so:
=TEXT(B2, "mmm")
You can then use an array formula to solve your problem. You might need to modify the formula slight based upon your data but the follow formula should work.
=AVERAGE(IF((C:C<>"Sat")*(C:C<>"Sun")*(D:D="May"),E:E))
Keep in mind because this is an array formula you have to hit Ctrl+Shirt+Enter on a PC or Command+Return on a Mac. Basically what it is saying is that if column C is not Sat and not Sun and column D is May, then average the value in column E.
Not too difficult.
Try this:
= SUMPRODUCT((WEEKDAY(B2:B99,2)<6)+0,D2:D99)/SUMPRODUCT((WEEKDAY(B2:B99,2)<6)+0)
I have the last row as 99 but you can just change that 99 to whatever your last row is that you need.
EDIT:
Just noticed you said "by month". The formula above will take the average column D where column B is a weekday. To modify for a specific month, the formula just needs to be slightly modified to account for the month also. See below, this shows how to do it for the month of May. (Month = 5) I broke it up into two lines so it is easier to read.
= SUMPRODUCT((WEEKDAY(B2:B99,2)<6)+0,(MONTH(B2:B99)=5)+0,D2:D99)
/SUMPRODUCT((WEEKDAY(B2:B99,2)<6)+0,(MONTH(B2:B99)=5)+0)
Similar to peter's answer, use the following formula in K2:
=SUMPRODUCT((WEEKDAY(B:B,1)>1)*(WEEKDAY(B:B)<7)*(MONTH(B:B)=MONTH(DATEVALUE("01-"&$J$2&"-2017")))*(D:D))/SUMPRODUCT((WEEKDAY(B:B,1)>1)*(WEEKDAY(B:B)<7)*(MONTH(B:B)=MONTH(DATEVALUE("01-"&$J$2&"-2017"))))
Warnings: Despite not being a CSE /ARRAY formula, SUMPRODUCT performs array like calculations within its brackets. As such, full column references like B:B should not be used. Instead B:B should be adjusted to match the needs of your data. In this case it should be B2:B22.
In the sumproduct formula above, the * are acting like AND statements. It evaluates a logical comparison to either true or false. If true or false is then put through a math operation, true values become 1 and false values become 0. Therefore only rows where everything is true are counted. The last step of the sumproduct is to sum all the results. Therefore all rows containing a false will become zero and not affect the summation.
The tid bit in the formula that refers to J2 basically converts what is assumed to be a month in text to a date that can be recognized by excel which then converts it to a numeric value which can then be compared to the month in your date list. Now the only caveat here is that its every month of year irregardless of the year. If you need a month from a specific year you will need the formula adjusted.
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 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))
I need a formula that can find the date in a cell next to another that has the first number in the column.
In column A I have dates and in column B onward I have stock prices. The dates goes back to 1990 daily, but not all the stock prices starts there. All of the prices end at 20-05-2015.
For all the stocks, I need to find out how many days they have been traded. I have the end date, but I need to look up the start date.
Therefore, I need a formula that says "Lookup the first cell which is numeric in column B, and take the corresponding cell in column A".
Thank you
You can use an array formula like this, assuming you have up to 1000 rows of data
=INDEX($A1:$A1000,MATCH(TRUE,ISNUMBER(B1:B1000),0))
confirm with CTRL+SHIFT+ENTER