Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Date & Quarters

  1. #1
    New Member
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Date & Quarters

    Hi,

    I need a simple formula to get the quarter number from date. In below table, if column A is already date, it should mention the quarter in column B. But if column A is already quarter, it should simply equal in column B. Changing date format is not an option. I tried to create a formula with IF+MONTH+SWITCH etc. but it becomes too complex to understand for other users.

    A B
    01.01.2018 Q1
    05.02.2018 Q1
    10.03.2019 Q1
    03.04.2019 Q2
    31.05.2018 Q2
    Q2 Q2
    Q2 Q2
    Q3 Q3
    Q3 Q3
    Q4 Q4
    Q4 Q4

  2. #2
    MrExcel MVP FormR's Avatar
    Join Date
    Aug 2011
    Location
    UK
    Posts
    6,089
    Post Thanks / Like
    Mentioned
    24 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Date & Quarters

    Hi, you could try:

    =IF(ISNUMBER(A2),"Q"&ROUNDUP(MONTH(A2)/3,0),A2)
    [code]your code[/code]

  3. #3
    New Member
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    Quote Originally Posted by FormR View Post
    Hi, you could try:

    =IF(ISNUMBER(A2),"Q"&ROUNDUP(MONTH(A2)/3,0),A2)
    Doesn't work. Probably because ISNUMBER returns FALSE as the input is having two dots (01.01.2018 not recognized as number)
    Also, there is no standard date format in A2, so how can MONTH(A2) identify a month out of A2.
    Last edited by raheem; Jan 10th, 2019 at 04:49 AM.

  4. #4
    MrExcel MVP FormR's Avatar
    Join Date
    Aug 2011
    Location
    UK
    Posts
    6,089
    Post Thanks / Like
    Mentioned
    24 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Date & Quarters

    Quote Originally Posted by raheem View Post
    Doesn't work. Probably because ISNUMBER returns FALSE
    Hi, it wasn't clear that your dates were text and not real excel date serial numbers.

    I would probably advise converting your text dates to real dates - but here is an alternative you can try.

    =IF(LEFT(A2)="Q",A2,"Q"&ROUNDUP(MID(A2,4,2)/3,0))
    Last edited by FormR; Jan 10th, 2019 at 05:02 AM.
    [code]your code[/code]

  5. #5
    Board Regular
    Join Date
    Apr 2016
    Location
    Vietnam
    Posts
    130
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    Quote Originally Posted by raheem View Post
    he input is having two dots (01.01.2018 not recognized as number)
    One way:

    =IF(COUNTIF(A2,"??.??.????"),"Q"&ROUNDUP(MID(A2,4,2)/3,0),A2)

  6. #6
    New Member
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    As I said in start, changing format is not an option. But the alternative is also fine.

    Thanks

  7. #7
    New Member
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    Quote Originally Posted by FormR View Post
    Hi, it wasn't clear that your dates were text and not real excel date serial numbers.

    I would probably advise converting your text dates to real dates - but here is an alternative you can try.

    =IF(LEFT(A2)="Q",A2,"Q"&ROUNDUP(MID(A2,4,2)/3,0))
    As I said in start, changing format is not an option. But the alternative is also fine.

    Thanks

  8. #8
    Board Regular
    Join Date
    May 2013
    Posts
    648
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    FormR was not asking you to change the format. He was asking you to supply dates as real dates, not text looking like dates.
    If they were real dates, they could still look like 10.01.2019, then ISNUMBER would work.
    Office 2007
    Access novice. Sometimes trying to give something back

  9. #9
    New Member
    Join Date
    Jul 2019
    Posts
    24
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    Hi, I am using this formula ="Q" & ROUNDUP(MONTH(A2)/3,0) & " "&year(A2). However some of the cells in A2 are blank and the value Q1 1900 is returned instead of blank. I have tried to add IFERROR but is till returning Q1 1900.

    A B B
    1 Dates Quarters Expected result
    2 Q1 1900 Blank
    3 30/09/2019 Q3 2019 Q3 2019


    I would really appreciate any help with this issue

  10. #10
    Board Regular
    Join Date
    Oct 2007
    Location
    Kuwait
    Posts
    449
    Post Thanks / Like
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Date & Quarters

    Quote Originally Posted by Mr_Lucky View Post
    Hi, I am using this formula ="Q" & ROUNDUP(MONTH(A2)/3,0) & " "&year(A2). However some of the cells in A2 are blank and the value Q1 1900 is returned instead of blank. I have tried to add IFERROR but is till returning Q1 1900.

    I would really appreciate any help with this issue
    How about this

    =IF(ISBLANK(A2),"","Q"&ROUNDUP(MONTH(A2)/3,0)&" "&YEAR(A2))

    Check the List of BB codes


Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •