Highlight current week in weekly rotation - google-sheets

Good Afternoon,
I am working on building a schedule that essentially uses a 3-week rotation to determine who is responsible for what tasks. I am trying to automate which week is highlighted and from there be able to automate which names show up.
Given a start day of say 7/4/2021 being week A, how can I identify all future week A, Week B, or Week Cs.

try:
=ARRAYFORMULA(IFNA(VLOOKUP(A1:A, {SEQUENCE(
TODAY()+1500-"7/4/2021", 1, "7/4/2021"),
"Week "&CHAR(64+ARRAY_CONSTRAIN(FLATTEN(ROUNDUP(SEQUENCE(ROUNDUP((
TODAY()+1500-"7/4/2021")/7), 7)/7)-ROUNDDOWN(SEQUENCE(ROUNDUP((
TODAY()+1500-"7/4/2021")/7), 1, 0)/3)*3),
TODAY()+1500-"7/4/2021", 1))}, 2, 0)))

=ARRAYFORMULA("Week "&CHAR(65+ROUNDDOWN(MOD((B2:2-"2021/04/07")/21,3))))

Related

How can I create a checkbox to select and then display week day wise progress comparison in Google sheet?

I need to know how to show week day wise progress comparison between different weeks in a Google sheet. So far, I have been able to show comparisons for a single day from each week but I am looking to get multiple week days (for example: week 10 should have day 1, day 2, day3 etc., week 11 should have day 1, day 2, day 3 etc. until day 7)
I am attaching a link to view the file for your convenience. What it is showing now is single day comparison but I would like it to display multiple days from each week.
[googlesheet]
https://docs.google.com/spreadsheets/d/1GNru6Kl0MEQFjJ5yTfYIyrMVw_Rp9vz-nSy6FAwShgw/edit#gid=1666606207

Update: How to calculate date and time duration into Days in google shee? (excluding Sunday)

I know it's basic but I'm new to this. I just want to know how can I calculate the days duration of the two dates?
For example, I have my start date and time 11/22/2021 15:20:43 and end date and time 11/23/2021 14:51:29 I want to calculate the total days from start to end date and time.
Also, If start date time column is BLANK, return to count of days including date today.
Thank you
All you need to do is use the following formula: '=(C2-A2)'. This will give you the elapsed time between the two cells and display it as hours. You can take this calculation further by adding dates too. This is useful if you have work shifts that go more than 24 hours or that include two days within a single shift.
Assuming start dates in column A and end dates in column B, you can try
={"Duration in Days"; Arrayformula(if(len(A2:A) * len(B2:B), datedif(A2:A, B2:B, "d"),))}
Change ranges to suit and see if that works?
EXAMPLE
REFERENCES:
DATEDIF
there is a DAYS formula exactly for that purpose:
update:
=INDEX(IFERROR(1/(1/DAYS(
REGEXREPLACE(TO_TEXT(B1:B), "(.|..)[\/\-\.](.|..)[\/\-\.](.+) (.*$)", "$2\/$1\/$3"),
REGEXREPLACE(TO_TEXT(A1:A), "(.|..)[\/\-\.](.|..)[\/\-\.](.+) (.*$)", "$2\/$1\/$3")))))
demo sheet

Formula to calculate historical data based off a specific condition?

I am trying to observe historical trends on customer acquisitions (new and returning) and am looking to use a formula to automate it for me.
Essentially, I am looking to determine the average amount of new customers we acquire on a specific day, specific week, and specific month. For example: what are the average customers we have acquired every Monday for the past 6 months, or what is the average number of customers we acquire the first week of every month?
Solution:
You can use the date operators in your QUERY statement to filter by month, week, or even day of week.
Examples:
every Monday for past 6 months
=query(A1:B, "select avg(B) where datediff(todate(now()),todate(A)) < 180 and dayofweek(A) = 2", 1)
first week of every month
=query(A1:B, "select month(A),avg(B) where day(A) <= 7 group by month(A) offset 1", 1)
You would need to tweak the sample queries to cover your data range and which columns do you need to average and compare.
References:
QUERY()
Query Language Reference | Scalar Functions

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!

Automatically find start and end of the work week in a Google Spreadsheet

My work week goes from Monday to Sunday and I need to find a way to have 2 different cells automatically update based on =today() what the actual date of the start and end of the current work week is.
Is there a formula that can find this?
Similarly:
Is there also a similar method to automate the first and last days of the current month in different cells?
Thank you ahead of time for any assistance
Assuming you're referencing a date in A1...
Start of the work week containing that date (assuming work week starts on Monday):
=A1-WEEKDAY(A1;3)
End of the work week:
=A1-WEEKDAY(A1;3)+6
Start of the month:
=EOMONTH(A1;-1)+1
End of the month:
=EOMONTH(A1;0)
I know this is Microsoft Excel documentation, but this describes the EOMONTH function.

Resources