+ Reply to Thread
Results 1 to 10 of 10

Converting dates to year/season

  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    Dublin
    MS-Off Ver
    Excel 2007
    Posts
    2

    Converting dates to year/season

    Hi There!

    I have a spreadsheet of 55,000 rows each of which contains a date in the format dd/mm/yyyy and I would like to create a column which contains yyyy/season. So far I can get excel to convert a cell into a season given the relevant date but I can't figure out how to append the year in front of the season. This is what I'm using to convert month to collelating season: =IF(MONTH(B2)<2,"WINTER",IF(MONTH(B2)<5,"SPRING",IF(MONTH(B2)<8,"SUMMER",IF(MONTH(B2)<11,"AUTUMN",IF(MONTH(B2)<=12,"WINTER","NONE")))))


    Thanks!!

    Nat
    Last edited by Biodiversity; 03-03-2011 at 06:34 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,953

    Re: Converting dates to year/season

    Please Login or Register  to view this content.
    For some reason, when I hit Save, the formula is changed from all uppercase to all lowercase. I have no idea why, but if you want your strings to be uppercase you can just add this immediately after your "="

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 03-03-2011 at 06:04 PM. Reason: changed formula to all uppercase
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Converting dates to year/season

    Biodiversity,

    In cell C2 enter (and copy down):

    =YEAR(B2)&"/"&IF(MONTH(B2)<2,"WINTER",IF(MONTH(B2)<5,"SPRING",IF(MONTH(B2)<8,"SUMMER",IF(MONTH(B2)<11,"AUTUMN",IF(MONTH(B2)<=12,"WINTER","NONE")))))
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719

    Re: Converting dates to year/season

    You could get the Season with a LOOKUP, i.e.

    =LOOKUP(MONTH(A2),{1,2,5,8,11;"Winter","Spring","Summer","Autumn","Winter"})

    What do you want to show for the year in winter? Is Nov and Dec 2010 and Jan 2011 all shown as 2010 or is it just the calendar year?
    Audere est facere

  5. #5
    Registered User
    Join Date
    03-03-2011
    Location
    Dublin
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Converting dates to year/season

    Thanks Stanley, SixstringJazzer and Daddylod legs for your replies! It's works now. Awesome!

    Daddylonglegs: I'm looking at variations of DOC and DOM concentrations in a water catchment area in west Ireland over the last 50 years in relation to season. Also using previous results to model predictions until 2100. All in all water's looking good for half of Co. Mayo for the next 90 years! If I haven't completely ballsed this up of course..

  6. #6
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: Converting dates to year/season

    Can someone help me. I can not seem to solve my problem. How determine the season (summer, winter, spring and autumn) based on the date
    Attached Files Attached Files

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719

    Re: Converting dates to year/season

    Assuming that all seasons start on 21st month except autumn which starts on 23rd then you can use this formula for any date in any year

    =LOOKUP(A2,DATE(YEAR(A2),{0,3,6,9,12},{21,21,21,23,21}),{"winter","spring","summer","autumn","winter"})

    ......or are the season start dates variable by year?

  8. #8
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: Converting dates to year/season

    Thank You daddylonglegs

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,953

    Re: Converting dates to year/season

    Dumy, unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  10. #10
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: Converting dates to year/season

    OK, sorry
    Thanks for the warning

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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