+ Reply to Thread
Results 1 to 9 of 9

YY/MM entries dependent on another cell

  1. #1
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    YY/MM entries dependent on another cell

    Hi,

    I'm doing a lot of analyses in Excel where I compare data between months. In order to reduce the amount of cells where I have to plug in numbers manually, I'd like to know whether the following is possible:

    Is there a function that will allow me to write "16-05" (i.e. May 2016) into cell B1 and then cell B2 will become "16-04" (April 2016) and cell B4 will become "15-05" (May 2015)? As of now, I write it manually.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by KasperMikkelsen; 05-06-2016 at 10:21 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: YY/MM entries dependent on another cell

    Hi,

    Add a proper date in B1. i.e. 1/5/2016
    In B2 enter : =EOMONTH(B1,-2)+1
    In B4 enter: =EOMONTH(B1,-13)+1

    Custom format all three cells as "YY-MM"
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: YY/MM entries dependent on another cell

    Enter in B2
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Enter in B4
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v B
    1 16-05
    2 16-04
    3
    4 15-05
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Re: YY/MM entries dependent on another cell

    Thanks a lot to both of you for your suggestions.

    I struggle with changing the format to "YY-MM". It does not show up as a possibility when I go into custom formatting.
    Attached Images Attached Images

  5. #5
    Registered User
    Join Date
    04-07-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: YY/MM entries dependent on another cell

    Hi,

    You can use the below formula and set the Number format as -- Custom (yy-mm) for these cells, B1, B2, B4

    Month Before that:
    HTML Code: 
    Same Month Year before:
    HTML Code: 
    Thanks & Regards,
    Vidhya

  6. #6
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Re: YY/MM entries dependent on another cell

    Is this the proper formatting? Because it does not seem to work with the formulae you have suggested
    Attached Images Attached Images

  7. #7
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Re: YY/MM entries dependent on another cell

    AlKey's method works for me with 16-05. However, when I change the "YY-MM" in B1, the formula does not work.

    vidhyakrr: Your method is working for me now. Thanks a lot!
    Attached Images Attached Images
    Last edited by KasperMikkelsen; 05-06-2016 at 10:21 AM.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: YY/MM entries dependent on another cell

    Quote Originally Posted by KasperMikkelsen View Post
    AlKey's method works for me with 16-05. However, when I change the "YY-MM" in B1, the formula does not work.

    vidhyakrr: Your method is working for me now. Thanks a lot!
    Please see attached file where cells are formatted as YY-MM
    Attached Files Attached Files

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: YY/MM entries dependent on another cell

    Here are two possibilities for your consideration.
    1/

    A
    B
    C
    D
    1
    Month chosen to analyze:
    16-05
    16-05
    =DATE(YEAR(B1),MONTH(B1),DAY(1))
    2
    Month before that:
    16-04
    16-04
    =EDATE(C1,-1)
    3
    4
    Same month year before:
    15-05
    15-05
    =EDATE(C1,-12)


    2/

    A
    B
    C
    1
    Month chosen to analyze:
    16-05
    2
    Month before that:
    16-04
    =DATE(YEAR(B1),MONTH(B1)-1,DAY(1))
    3
    4
    Same month year before:
    15-05
    =EDATE(B1,-12)


    In case you want to see them in a file with the formatting I have enclosed the file. The dates are formatted yy-mm as a custom date format.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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. Replies: 5
    Last Post: 12-08-2015, 01:47 PM
  2. Dependent combo box with two-word entries
    By mfortier3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-08-2013, 07:55 PM
  3. Dependent dropboxes which can select multiple entries
    By kleclark in forum Excel General
    Replies: 21
    Last Post: 11-26-2012, 01:40 AM
  4. [SOLVED] Counting unique entries only once & 3rd layer of dependent choices
    By ObiWanBaloney in forum Excel General
    Replies: 0
    Last Post: 06-04-2012, 06:16 PM
  5. Conditional Drop Down dependent on 2 entries.
    By lancekaye in forum Excel General
    Replies: 10
    Last Post: 05-24-2012, 08:08 AM
  6. Replies: 2
    Last Post: 02-16-2012, 12:53 PM
  7. Cell entries dependent on other cells
    By pie-eater in forum Excel General
    Replies: 6
    Last Post: 07-19-2010, 05:02 PM

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