How to get week number of the month by week number of the year - excel

I only have week number for the year. How can I get the week number of the month?
For ex:
Week
42
Week of the month
2
How can I get the “2” in excel?

I have created a formula for you.
=INT( DAY( (A1-1)*7+ (DATE(B1,1,1)+ (8-WEEKDAY(DATE(B1,1,1),2))) ) / 7)
The formula is inserted in C1, year is present in B1 and week number is present in A1
Week numbers are according to ISO stranded.

Related

Formula based on first monday or tuesday etc of the week

Is there a way to put a year into a cell (say A1), then the day of the week you want (say Monday in cell A2) and enter into the 12 cells below it the first monday of each month (or first tuesday, etc, based on whats in cell A2)?
I have been able to figure out how to do it with 1 day but I would like it to be interactive.
=DATE(2022,{1;2;3;4;5;6;7;8;9;10;11;12},7-WEEKDAY(DATE(2022,{1;2;3;4;5;6;7;8;9;10;11;12},1)-5,3))
With Office 365:
=LET(yr,A1,
wkdy,MATCH(PROPER(A2),{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"},0),
mnt,SEQUENCE(12),
DATE(yr,mnt,1)+MOD(8-WEEKDAY(DATE(yr,mnt,1),10+wkdy),7))
You where pretty close with your formula
=DATE(A1,{1;2;3;4;5;6;7;8;9;10;11;12},7)-WEEKDAY(DATE(A1,{1;2;3;4;5;6;7;8;9;10;11;12},7),A2)
Where
A1 = year string
A2 = day of the week as number (1 = Saturday, 2 = Sunday, etc.)

Excel Formula: Current 12 months

I'm looking for a formula in excel that will give me a current 12 month table. For example this month is April. I want a formula that gives me 12 months back from April in the exact format as show in the table below. For next month it will be May, and 12 months back from may without having to adjust any dates.
Month
5/1/2015
6/1/2015
8/1/2015
9/1/2015
10/1/2015
11/1/2015
12/1/2015
1/1/2016
2/1/2016
3/1/2016
4/1/2016
Thank you
Try this and copy down 11 rows
=EDATE((TODAY()-DAY(TODAY())+1),ROW(A1)-12)
If you number the months in column b starting from b2 =0 to b13=11
And row 1 has headers
A2 formula =EOMONTH(today(),b2-1)+1
A3 formula = EOMONTH(today(),b3-1)+1
Etc.
EOMONTH will give you the last day of any month. So if we start with today() it will give you the last day of the current month, but if we count back 1 month (b2-1). It will give you the last day of last month. So we add 1 day to it and you get the first day of each month.
Hope this helps :)

Randomly generate 2 dates per week over 2 years

How do I write an excel formula, which randomly picks 2 dates in each week over a 2 year period, where:
The 2 dates per week are not the same as each other
So this should not happen:
05/02/2015
05/02/2015
The first date in any given week is always before the second date of that same week:
So this should not happen:
06/02/2015
05/02/2015
Where Sunday is the beginning of the week and Saturday is the end of the week:
Here is an example of what I am after:
week day date
1 1 01/01/2015
1 2 03/01/2015
2 1 05/01/2015
2 2 08/01/2015
And so on, all the way to the end of 2016.
This is what I have so far, but this only randomly gives me a day of a week, and doesn't fulfill any of the criteria I've described above:
=CHOOSE(WEEKDAY(ROUND((RAND()*(7-1)+1),0)),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
There are 21 different combinations of 2 days in a week - to ensure an even distribution you can use a helper column, so assuming your weeks start at A2 and days at B2 (always showing 1 then 2 in days column for each week) then use this formula in D2
=IF(B2=1,RANDBETWEEN(1,21),"")
and this formula in C2
=IF(B2=1,E$1+MATCH(D2,{1,7,12,16,19,21})-8+A2*7,C1+D1-LOOKUP(D1,{1,7,12,16,19,21})+1)
where E1 contains the start date (a Sunday) of week 1
fill both formulas down the column
You can hide column D if required
See example here

In Excel, how to calculate # of days between a date range, counting only specific days of week

I'm trying to get # days between 2 dates, but had to count only days of the week specified per pair of dates in questions.
For example:
Date of operation = 9/1/2013 and 5/16/2014
Days of the Week in operation = Monday, Wednesday, Friday
I want to calculate total number of days in actual operation, given the days in operation per week.
If you have Excel 2010 or later you can use NETWORKDAYS.INTL function which allows you to customise which days are counted, e.g. the following formula will count Mondays, Wednesdays and Fridays between a start date in A2 and an end date in B2 (inclusive) while excluding holiday dates listed in H2:H10
=NETWORKDAYS.INTL(A2,B2,"0101011",H$2:H$10)
The string "0101011" defines the days to include - 0 is included, 1 is excluded - it starts with Monday
In earlier excel versions you can use this formula for the same result
=SUMPRODUCT((WEEKDAY(ROW(INDIRECT(A2&":"&B2)))={2,4,6})*(COUNTIF(H$2:H$10,ROW(INDIRECT(A2&":"&B2)))=0))
where {2,4,6} defines the weekdays to include (1=Sun through to 7=Sat)
The number of days between to dates is just date1 - date2.
One method is to divide the number of days in operation by the number of days in the week. In this case that would be 3/7. In this example, the number of days in operation would be 110.14 days. Below is your example. cell B4 has 1-sep-13, b6 has 16-may-14, both formatted as dates.
B
4 41518
6 41775
8 =B6-B4 Days
9 =B8/7 Weeks
10 =B8*3/7
01-Sep-13
16-May-14
257 Days
36.71 Weeks
110.14
To get more accurate, you would need to know which day of the week, weekday(), the first day in your range was and which day of the week your last day was.

How to calculate a monthly average when the month is not finished

Let's say I have a 12 cells on column A with the sales for each month last year. To calculate a monthly I can do a simple formula like this in A13 =sum(A1:A12)/12. But in column B I have the sales for this year, not a complete year, and August is not finished, but I have the running amount of sales for this month, so far. What kind of formula can I use to return a more accurate average?
Eduardo
Divide the current total by the total number of days in the month that have passed so far. Then multiply by the total number of days in the month.
If you are only looking for a projection for the year I would recommend this:
Divide the sum you have for the current year * 365 so far in the data by days to date. That will give you a cheap sum.
sum * 365 / total days to date
Ideally you could figure out the ratio of revenue and you have a seasonal business:
Last year to date / last year total = Last year percentage to date
This year to date / Last year percentage to date : would project the average for the full year.
Easy 2-step process:
I have my data in two columns: Date, # of Widgets Sold
Add a 3rd column "Month", and use the month and year function to return the month for each date (format cells as a number) (e.g., =MONTH(A2)&"/"&YEAR(A2) )
Generate a pivot table using the # of Widgets Sold and Month columns that sums/averages the data by month

Resources