Google Sheets: Show upcoming dates for certain day of the week - google-sheets

I am working on a weekly budget sheet and I would like to show dates for each upcoming friday for the current month. How can I do this?

You may apply sequence formula to generate a serial of number for each Friday day and to return all the subsequence date for your budgeting:
=arrayformula(date(year(A1),month(A1),
SEQUENCE(ROUNDUP(DATEDIF(A1,EOMONTH(A1,0),"D")/7,0)-1,1,DAY(A1)+7,7)))
So how does it work:
date(year, month, day)
Return a new date from the number given by formula
ROUNDUP(DATEDIF(A1,EOMONTH(A1,0),"D")/7,0)-1
To calculate to total number of remaining week between the current date and end of the month, you can use Rounddown but need take remove minus 1 at the back
DAY(A1)+7
Return the day of next Friday based on the current Friday date
SEQUENCE(row,column,start,steps)
The row value will determine how many counts of value to be populated, which is the number of week from above formula, start will be start date of next Friday, and step is every 7 days
Sample Sheet:
Remark:
You can add the if statement to return blank when the number of remaining week is 0 to prevent the formula return error
if((ROUNDUP(DATEDIF(A1,EOMONTH(A1,0),"D")/7,0)-1)=0,""

Related

How to get the average of the last cells in a column based on the last month?

I have a sheet that contains an amount in column D and the week number(A), month number (B), and year(C). How do I get the average of the last month's amount (D)? So in the example below, I am looking for the average of D251 to D254 based on last month (Column B) 7. Then next month, with it's September, The same cell would average all the "Amounts" in column D for the month of last month, Aug 8th. I hope that all makes sense.
How do I get the average of the last month's amount (D)?
You can use AverageIF, or possibly AverageIFs (plural) to account for prior year. I updated my example. You also might consider a different structure/column for time that combines Year_Month. See example in sheet.
Formula used:
=IFERROR(AVERAGEIFS(D:D,B:B,if(B2=1,12,B2-1),C:C,if(B2=1,C2-1,C2)),"First Period")
See this example.
Please try the following
=AVERAGE(INDEX(FILTER(A2:D,B2:B=MAX(B2:B)),,4))

How to auto create a Month calendar in google sheets. Where first day of the month start in the colum of the (name)day

I want to create a calendar like in the second image. But I can not figure out how to start the first column is a monday. So I fill it by 'hand' like in the first image.
I tried to create it automatic. Starting with the first day of the month and add one day the next columns like in the second picture:
How I want it to look like:
How it is currently looking:
Google sheets example
I was solving the same problem for my bussiness, and I think I got the answer.
Your first task is to determine the first "calendar monday" of the month.
First, build the first day of the corresponding month:
[B2] =DATE(YEAR(A1); MONTH(A1); 1)
Then, get the WEEKDAY of the corresponding first day. The second argument represents what day your week starts with:
If type is 1, days are counted from Sunday and the value of Sunday is 1, therefore the value of Saturday is 7.
If type is 2, days are counted from Monday and the value of Monday is 1, therefore the value of Sunday is 7.
If type is 3, days are counted from Monday and the value of Monday is 0, therefore the value of Sunday is 6.
In my case, we count the week starting from Monday. This means when the first day of the month lands on Monday, the return value will be 0.
[C2] =WEEKDAY(B2; 3)
The number you get represents how many days you need to substract from the initial date to get the first "calendar monday" of the month:
[D2] =B2 - C2
This date is what you are looking for. The final formula:
[A3] =DATE(YEAR(A1); MONTH(A1); 1) - WEEKDAY(DATE(YEAR(A1); MONTH(A1); 1); 3)
The rest of the days, simply add 1 to each preceding date.
[A4] =A3 + 1
[A5] =A4 + 1
And so on.
Secondly, set the Number Format on the calendar cells to just show the day.
Format -> Number -> More Formats -> More Date and Time Formats.
Select just the day from the drop down.
Finally, use conditional formatting to "hide" the values that don't match the initial date
Use a custom formula for the formatting, as follows:
=MONTH(A3) <> MONTH(A1)
Apply to the calendar range. This will format dates that don't belong to the current date, so make sure to paint that white.
And that's about it. Good luck!

Google Sheets COUNT number of occurrences based on the DAY of the DATE, disregard month and year of the date

I need to count a number of occurrences for each day in a month, but the formula must not include month and year because I need to reuse it every month.
I have a table with rows and columns like this:
1 2 3 4 5 6 7 8 ... 31
Under each of these dates I need to inserted the counted number of occurrences for that day of the month.
Try,
=sumproduct(--(day($B2:$B)=E1))
I happened to have some dates lying around. Here's a sample.
Linked spreadsheet

Excel Formula: weekly comparison with corresponding week of previous month

I'm trying to create a week on week comparison in Google Sheets.
The nuance is that the Comparison Week needs to dynamically populate as the corresponding week of the previous month.
So if the dataset is the first week of May, the Comparison Week would be the first week of April. Likewise, week 2 of May would be compared to week 2 of April, etc.
As an example, if A1 is 5/1/2016 and A2 is 5/7/2016, cells B1 and B2 should populate as 4/3/2016 and 4/9/2016 respectively (where Sunday is the first day of the week).
I've built the following formula which I think gets me about halfway:
=WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),1)+1
This formula returns the week number in the month from a given date. For example, 5/1/2016 returns the value '1' because the date occurs on the first week of the month. 5/8/2016 would return '2', etc.
Use formula below. It looks ugly, but it should work exactly as your example.
As an example, if A1 is 5/1/2016 and A2 is 5/7/2016, cells B1 and B2
should populate as 4/3/2016 and 4/9/2016 respectively (where Sunday is
the first day of the week).
=DATE(YEAR(A1),MONTH(A1)-1,DAY(A1)+IF(WEEKDAY(A1-DAY(A1)+1)=1,8,WEEKDAY(A1-DAY(A1)+1))-WEEKDAY(DATE(YEAR(A1),MONTH(A1)-1,1),1))
here is how it works
=DATE(
YEAR(A1),
MONTH(A1)-1,
return date of previous month with day calculated as follows:
DAY(A1)
start at the current date
+IF(WEEKDAY(A1-DAY(A1)+1)=1,8,WEEKDAY(A1-DAY(A1)+1))
find out what day is the first day of the current month and add its number. Only if it is Sunday (1st day of week) it needs to skip week 0 so it adds 8
-WEEKDAY(DATE(YEAR(A1),MONTH(A1)-1,1),1)
deduct number representing first day of previous month
So for example if you have 5/3/2016 it does:
(3rd day of month) + (first day of current month in Sunday, so add 8) - (first day of previous month is Friday, so it deduct 6)
3 + 8 - 6 =5 and this is day of previous month, so result is 4/5/2016

Showing days passed in month, or total days in month if the month is over (google spreadsheets)

Looking for a formula (for google spreadsheets) that shows either the days past in the current month if we're not past the last day of the current month, or the total days in that month if that month is behind us.
So, if today's March 25th, the formula would output 25 ... if today's April 1st, though, the formula would output 31.
Based on your sample, this should work (assuming the date is in A1):
=if(day(A1)=1,A1-date(year(A1),month(A1)-1,1),A1-date(year(A1),month(A1),1)+1)

Resources