Weekday/ work day excel dates - excel

How do you do this in excel without entering it all manually for the rest of the year? Its work days.
JANUARY
03 04 05 06 09 10 11 12 13
T W T F M T W T F
So for January I need all the work days in numbers and in days in text like below:
For January the first working day is 03 and that day is T(Tuesday). I need a formula to show on the first column 03 and then the 2nd row will show T for tuesday. I want this to continue for the rest of January.
January
03
T

If you don't mind using Analysis ToolPak functions you can try this approach:
First you need a list of holiday dates, e.g. 2nd Jan 2012, 6th April 2012. List these one per cell, perhaps in another worksheet and name that list holidays.
In A1 put the first of the month you want to see, e.g. 1/1/2012 (if you want it to default to current month always then use this formula =EOMONTH(TODAY(),-1)+1) - format that cell as mmm-yy
Now use this formula in A3 copied across to W3
=IF(WORKDAY($A1-1,COLUMNS($A3:A3),holidays)>EOMONTH($A1,0),"",WORKDAY($A1-1,COLUMNS($A3:A3),holidays))
format cells with custom format dd
and then in A4 use this formula copied across to W4
=LEFT(TEXT(A3,"ddd"))

Related

Dynamic Range for Average Calculation

I am trying to come up with an Excel Formula to calculate 6 Months average value from Monthly prices.
A year is considered from April 2022 to March 2023 and so on. That means from April 2022 to Sept 2022 it is Half 1 and Oct 2022 to Mar 2023 it is Half 2.
Total time line is till March 2055. So, the formula has to be dynamic.
Please advise how I can use a formula for this averaging task.
The Data table look like below.
INPUT
Please refer the link to picture
OUTPUT
In Yellow in the picture below
Table Pic
Thank you!
It would be fairly simple if we had 'regular' half-year periods. Since half-years are shifted 3 months forward, we also need to shift the formula by three months. To achieve that, we have an OFFSET function that we can apply for the prices row. It will work fine for all the half-year periods with the exception of the first one since we'll have the prices range shifted. So, for the first half of 2022 in the cell B9 we will simply write =AVERAGE(B5:G5) and for all the rest, starting from C9, -
=AVERAGEIFS(OFFSET($B$5:$OG$5,0,3),$B$1:$OG$1,C7,$B$2:$OG$2, IF(C8=1,"<="&6,">"&6))
assuming that the months start in column B like in your example picture and finish in column OG as suggested from your task description.
If you want rolling 6mo periods, I prefer INDIRECT to OFFSET.
Assume the data runs vertically, each month is a separate row, and "X" is the cell of the latest value, this should work:
=AVERAGE(INDIRECT(ADDRESS(ROW(x), COLUMN(X))&":"&ADDRESS(ROW(X)-5, COLUMN(X))))

How to get first month of the year from TODAY Function in Excel?

In a excel sheet range A1:A12, I need months like:
Jan 2020 to Dec 2020 for current year.
and Jan 2021 to Dec 2021 for next year. and so on. Automatically.
I google it but did not find any suitable result.
Plz help me and ignore my weak English and grammar.
Thank You.
Let's say you want a real date, using the 1st of each month (you can then format the cells to just show mmm yyyy or whatever other format you like). In your first cell enter:
=DATE(YEAR(TODAY()),ROWS($A$1:$A1),1)
and copy it down. If you actually want the month as text, just wrap that in the TEXT function:
=TEXT(DATE(YEAR(TODAY()),ROWS($A$1:$A1),1),"mmm yyyy")
Note that the DATE function will happily adjust the year if you pass a month number greater than 12.
Use below formula-
=TEXT(DATE(2020+INT(ROW()/13),MOD(ROW(),13)+INT(ROW()/13),1),"mmm-yyyy")
To get This using =TODAY() function you have to use 2 cells.
Let's use A1 and B1 as the 2 cells.
In A1 you will display today's dat as dd/mm/yyyy
=TODAY() type this in A1
In B1 you will convert it to month and year.
=TEXT(A1,"mmm-yyyy") type this in B1
But using this method you can only get this month.

Issue with negative numbers in NETWORKDAYS for Due and Performed dates

I am trying to figure out how to use Conditional Formatting to setup so any dates under "Performed" regardless of before or after "Due" date will show specific formatting using NETWORKDAYS. Any dates of over 3 or more days (both plus and minus of "Due") will be red. And any dates of 2 or less days (both plus and minus of "Due") will be green.
I require these to be working/week days where if the "Due" date is e.g. 02 Nov 2020, and the performed date is 03 Nov 2020 (under 2 days) will be green. But if performed on the 28 Oct 2020 (as it is over 2 working days) will be formatted red.
Excel showing image of spreadsheet
I have currently used the following codes:
=NETWORKDAYS($D$5,$E$5)<3
=NETWORKDAYS($D$5,$E$5)>3
The first for the green, and the second for red.
Any help will be helpful.
Try using absolute value in your formula? For example:
=abs(NETWORKDAYS($D$5,$E$5))>3

Convert date column

I have data in an excel sheet. There I have a column with date values like this.
13 May 2012
27 August 2012
21 June 2012
18 March 2012
16 November 2011
15 December 2011
Is there a way to convert it to a format like this? 1998-12-25
I am assuming your dates are stored as strings. If one of your data is in cell A1, use in B1
=DATEVALUE(LEFT(A1,FIND(" ",A1)-1)&" "&LEFT(MID(A1,FIND(" ",A1)+1,FIND(" ",RIGHT(A1,LEN(A1)-FIND(" ",A1)))-1),3)&" "&RIGHT(A1,4))
Then format B1 as Custom, Type: yyyy-mm-dd.
Shorter formulas are possible, in particular if you can assume that the day will always have two digits (e.g., 01, and never 1).
If your data are stored as numeric instead of string, then simply apply the formatting procedure described.

Excel: show matches occurrences

I have 1 column with dates and another with user log ins. I want to see how many times a user logged in per day.
02 January 2013 wright
02 January 2013 wright
02 January 2013 paula
02 January 2013 john
02 January 2013 paula
03 January 2013 john
03 January 2013 wright
I want to turn this into
02 January 2013 03 January 2013
wright 2 1
paula 2 0
john 1 1
Is there an easy way of doing this? Thank you for any help.
I understand that I can use pivot table to change the spreadsheet into this:
02 January 2013 03 January 2013
wright
paula
john
But do not understand how I can use pivot table to add the instances of each logged entry to a date.
You can use VBA which gives you full control on the output.
Are you familiar with VBA? If so I can provide you the code.
lets assume your list of dates in in column B and your list of user ids in in column C.
Generate a list of unique names
in this case I am arbitrarily generating the table in E9 as the top left corner. In E10 I place the following CSE formula (mean you press CONTROL+SHIFT+ENTER instead of just ENTER). You will know you have done it right when excel adds {} around the formula. You cannot manually added them.
=IF(ISNA(INDEX($C$2:$C$20, MATCH(0, COUNTIF($E$9:E9, $C$2:$C$20), 0))), "", INDEX($C$2:$C$20, MATCH(0, COUNTIF($E$9:E9, $C$2:$C$20), 0)))
Copy down as far as you need
Place a date in excel format in F9
Copy right as far as you need. It should increase by one day for each column copied
In cell F10 place the following formula and copy and paste down and to the right as far as required.
=COUNTIFS($C:$C,$E10,$B:$B,F$9)
Having said all this a pivot table can do it much quicker and faster.

Resources