+ Reply to Thread
Results 1 to 6 of 6

If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

  1. #1
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

    Okay, what I'm trying to do is come up with an IF statement (or if there's an easier way I'm open to that) to get the quarter and year of a date. So I want my IF statement to put out something like Q1 2018. Right now I have three columns - the 'date' and a column for the month derived from that date and a column for the year derived from that date.

    My formula, which doesn't work, looks like this:

    =IF(OR(B2="January"&C2=2018,B2="February"&C2=2018,B2="March"&C2=2018),"Q1 2018",IF(OR(B2="April"&C2=2018,B2="May"&C2=2018,B2="June"&C2=2018),"Q2 2018",IF(OR(B2="July"&C2=2018,B2="August"&C2=2018,B2="September"&C2=2018),"Q3 2018",IF(OR(B2="October"&C2=2018,B2="November"&C2=2018,B2="December"&C2=2018),"Q1 2018",""))))

    I tried to do an if statement with an 'and' and an 'or' but that really didn't turn out well....

    Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

    Oops, missed the year:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    Re: If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

    .....

    My formula was ten million characters and didn't work.

    TMS's was a brilliantly short formula and totally works.

    I gotta up my excel game.

    Thanks TMS!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

    You're welcome. Thanks for the rep.



    To be fair, I picked it up from elsewhere and adapted it a tiny bit. Sometimes it just needs a step back and knowing what to Google For example, Google: excel formula to convert month to quarter

  6. #6
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    Re: If statement trying to get Q1 2018, Q2 2018, Q1 2019, etc

    Knowing what to google is a good point. I try to use google as a resource, but sometimes I'm just not putting in the right words.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Reflect TBF vacancies over 2018-2019/2019-2020 budget year
    By jennah63 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2019, 07:32 PM
  2. Call in the Cavalry - 2018
    By AliGW in forum The Water Cooler
    Replies: 152
    Last Post: 01-10-2019, 12:06 PM
  3. Determine last and current month (2018 - 2019)
    By Bandito1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2019, 06:09 AM
  4. [SOLVED] Amend VBA to add dd-mm-yyyy at end of file name as it show 5-2-2018 instead of 05-02-2018
    By robertguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2018, 10:58 AM
  5. how to sort Week no- Year (04-2018, 05-2019, 07-2018) in pivot chart.
    By sahana108 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2018, 09:07 AM
  6. Fiscal Year 2018 ( Feb 4, 2017 - Feb 3, 2018)
    By chethan1333 in forum Excel General
    Replies: 1
    Last Post: 05-09-2017, 08:40 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1