Excel COUNTIFS with NETWORKDAYS between a column and a date, excluding holidays - excel-formula

I have a table with one column containing start dates. How can I get the weekly count of the no. of rows/records which are older than 15 days by weekend, for every week. This should be excluding weekends and holidays? Please see attached image for reference.

Assuming that the expected result will include all dates older than the weekend on the current row for that city, you can use NetWorkdays nested in a Sumproduct.
In the screenshot, the formula is
=SUMPRODUCT(--(NETWORKDAYS($B$2:$B$14+0,$F3)-1>15),--($D$2:$D$14=G$2))

Related

calculating dates in excel to return specific date

I have dates of all my purchases in one column, amounts in another column, all purchases up to the 22nd of month are due on the 10th of the following month.
I want excel to create a list of purchases due each 10th of the month!
anybody have a formula?
Try this formula
=EOMONTH(D3-22,1)+10
...so if D3 contains the date 22-Oct-2017 that will return 10-Nov-2017, but if you change D3 to 23-Oct-2017 then 10-Dec-2017 will result

Calculate monthly average from daily data without PivotTable

My worksheet contains two columns: column A contains the date in the format dd/mm/yyyy and column B contains the daily data. From the daily data I have to generate the monthly average for each month without a PivotTable. Some of the days contain no data at all. I cannot use a PivotTable as I have to use the monthly average to identify outliers in the daily data at a later stage.
For this example it's important that I don't use a PivotTable and that I can generate the monthly average data for any month and year in my list. The solution can be an Excel formula or VBA.
Assuming you have the months in column D enter this formula in E2 and copy till last month
=AVERAGEIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0))
Some of the days contain no data at all.
In case this means that there are no row for some dates and you want to calculate average based on full month than you can use the below formula:
Continuing with example given by EEM
=SUMIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0))/DAY(EOMONTH(D2,0))
In case Daily Data contains some #N/A, one can add a additional criteria to skip non number data:
=AVERAGEIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0),$B$1:$B$62,"<10E69")
Given a single date you can calculate both the End of the Month and the First of the Month for that date. Assume any given date is in E4:
For the End of the Month
=EOMONTH(E4,0)
For the First of the Month
=EOMONTH(EDATE(E4,-1),0)+1
If you place a date, any date, of the month you want to review into cell E4 the two above code snipets will give you and last and first days of the month. EDATE allows you to add and subtract whole numbers to change the month. We take one month away from the current month, found within the date in cell E4, and then find the end of the month and add a one to it to become the first day of the next month. It will work with any date. The below example shows grade averages over a month referencing any given date within the month.
Pic of the above Excel example
=AVERAGEIFS(C2:C11, B2:B11,">=" & EOMONTH(EDATE(E4,-1),0)+1, B2:B11,"<=" &EOMONTH(E4,0), A2:A11, E2)

Excel Formula: Get Year to Date Workday Count in Current Month

I need a formula that gives me the YTD workday count for each month.
For example:
If today is 8/6/2015 - the workday count should be 17 (excluding weekends)
If today is 9/3/2015- the workday count should be 18 (excluding weekend and 1 holiday)
Thanks,
This is just the native Excel function:
=NETWORKDAYS(TODAY(),DATE(YEAR(TODAY()),MONTH(TODAY()),31))
Note that you will need to choose a set of holidays to exclude from the working days function, and define that as a Name in the Formula Ribbon -> Name Manager. ie:
=NETWORKDAYS(TODAY(),DATE(YEAR(TODAY()),MONTH(TODAY()),31),CustomHolidays)
Where CustomHolidays has been defined as a name which means:
={02/14/2015;03/15/2015;...}
You need NETWORKDAYS between the first of the month, and the last of the month.
Assuming your date is in A2, first of the month is simple, A2-DAY(A2)+1. Last of the month is harder as it could be 28, 29, 30 or 31. Youy can use EOMONTH to get this though, EOMONTH(A2,0)
Put it all together
=NETWORKDAYS(A2-DAY(A2)+1,EOMONTH(A2,0))
As has been commented, you can also include holidays if you wish to exclude these.

How to calculate values in a column based on only weekends ( saturday and sunday) in excel?

I have a column 'day' (C6:C37) showing the day of the month and a column 'dailytotal' (F6:F37) showing the total expenditure on each day. I want to calculate total expenditure only on weekends.
How do I calculate the sum of values in 'dailytotal' when Saturday or Sunday is in column 'day'. How can I use SUMIF here for my requirement?
You can use the WEEKDAY function to determine what day a date falls on. However, there's no way to use that directly with a SUMIF formula.
Alternatively, you can use a SUMPRODUCT formula:
=SUMPRODUCT(--(WEEKDAY(C6:C37,2)>5), F6:F37)
If you HAVE to use sumif (though Michael's solution works nicely). Here is what you can do.
Add a column (I will refer to as "weekday_range") that takes the =weekday(date, 2) (and fill down column)
THEN you can use
=sumif(weekday_range, ">5", daily_total_range)
you can then hide the column that weekday_range is in if needed

Excel to specify the month to report the data

Using excel, is it possible to specify the month to report in a cell?
For example, excel would need to report the latest reported sales, if its available. If the month of February sales is not available, then it will report January sales. Likewise, if March sales is available, it would report the sales in March.
How do you write this formulae in a cell in excel? If its not possible to write such a formuale, can we write a vba to do this?
If you mean you have a list of sales entries and want the sales for the last month in the data, you could write one formula to get the latest month. If months are in A you could write: =month(max(A1:A99999))
Note if you have multiple years data, you need to pull the year too or get bounding dates. You can then sum sales using an array formula like assuming the result of the first action is in D1 and sales are in B: {=sum(if(month(A1:A999999)=D1,B1:B999999,0))}
If you have incremental updates during the month, this will return month to date data. If you need data for the last full month, you can use another array formula to get the maximum month where the date is the last day of the month.
If the cells for future data in B1:B12 are blank then you just need to extract the last number in B1:B12 don't you? If so then try
=LOOKUP(9.99E+307,B1:B12)
You can use the OFFSET function to select specific data based on the month.
Insert a formula to calculate the current month (or just type in the month number)
=MONTH(TODAY())
The formula to select the current months of sales data
=SUM(OFFSET(B1,MONTH(TODAY()),0,1,1))
Have a look at the help in Excel on the OFFSET function. It can be used to select a range of data. For example, to return data from the start of the year to the current month the formula would be:
=SUM(OFFSET(B1,1,0,MONTH(TODAY()),1))
If the current month does not contain data yet, you can test to see if a value is returned and revert to the prior month if there is no data.
=IF(SUM(OFFSET(B1,B16,0,1,1))=0,SUM(OFFSET(B1,B16-1,0,1,1),SUM(OFFSET(B1,B16,0,1,1))))
I found this answer:
=IF(B12<>0,B12,IF(B11<>0,B11,IF(B10<>0,B10,IF(B9<>0,B9,IF(B8<>0,B8,IF(B7<>0,B7,IF(B6<>0,B6,IF(B5<>0,B5,IF(B4<>0,B4,IF(B3<>0,B3,IF(B2<>0,B2,IF(B1<>0,B1,0))))))))))))
This formulae solves the problem of picking up the latest available data.

Resources