-2

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 :

enter image description here

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 :

enter image description here

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.

2 Answers 2

2

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

  • First day (date) of the week for a given date: date - (WEEKDAY(date,2)-1)
  • Last day (date) - date +(7-WEEKDAY(date,2))
  • So the following will get the result in the format you want
    • please note that it is correct for this particular date range
  • It is an array formula, so there's no need to drag-down
=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")
        )
)

Result

Sign up to request clarification or add additional context in comments.

Comments

0

Give a try to the following formula-

=TEXT(A2,"mmm") & " " & MOD(DAY(A2),7)*7+1 &" - " & (DAY(A2)-6)*7

enter image description here

3 Comments

Hi Sir, thank you for your response. I have tried your formula but the result is different than yours above. I get the result like this : Jan 8 - -35. Have you formatted you date column in different type?
Please advice and explain me about you formula, Sir. Why the result is different than your?
@Joinnes What result do you get? Can you show a screenshot?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.