Much appreciate all of you for helping me to solve my case in Excel.
I want to create a date range in Excel but the data I have will have a lot of repetition because it is based on the ticket creation date. I want to create a date range like this :
I have a formula like this :
=TEXT(R2,"MMM D") & " - " & TEXT($R$2+ROWS($A$1:A1)*6,"D")
The case is every I drag the data the value on the end range always changes +6 like this :
Please give me a solution and advice on how to create a correct weekly date range according to the first picture I attach above.
Thank you.
It looks like you want to get the result in format
"mmm" "first day of the week" - "last day of the week", with Monday being the first day of the week. Please pardon me if I got it wrong.
WEEKDAY function - Microsoft Support
date - (WEEKDAY(date,2)-1)
date +(7-WEEKDAY(date,2))
=TEXT(R2:R28-(WEEKDAY(R2:R28,2)-1),"MMM D") & " - " & TEXT(R2:R28+(7-WEEKDAY(R2:R28,2)),"D")
Using LET
, also handles if months are different for start/end dates:
=LET(
dates, R2:R28,
first_day_of_week, dates - (WEEKDAY(dates, 2) - 1),
last, dates + (7 - WEEKDAY(dates, 2)),
TEXT(first_day_of_week, "MMM D") & " - " &
TEXT(
last,
IF(MONTH(first_day_of_week) = MONTH(last), "D", "MMM D")
)
)