+ Reply to Thread
Results 1 to 12 of 12

VLOOKUP to write name of month in a cell

  1. #1
    Registered User
    Join Date
    05-04-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    30

    VLOOKUP to write name of month in a cell

    Hi everyone

    I'm trying to get this VLOOKUP formula to work. I'm trying to get Excel to "pick up" the name of a certain month from another sheet. In Sheet1 I have Month# from 1-12 in cells A2:A13 and Monthname from January to December in cells B2:B13.

    In Sheet2 I have Month# for 4 years (4 times 1-12) in Cells A2:A49, and I want Excel to fill in the correct Monthname in cells B2:B49. It works with the first 12 months, but the second time the formula returns #I/T.

    This is the formula (written in Sheet2, cell B2):

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to write name of month in a cell

    Should it be?

    =VLOOKUP($A$2;Sheet1!$A$2:$B$13;2;FALSE)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP to write name of month in a cell

    Try this:

    =INDEX(Sheet1!$B$2:$B$13; IF(MOD(ROW(A1);12)=0; 12; MOD(ROW(A1);12)))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: VLOOKUP to write name of month in a cell

    Try changing your semi-colons ; to commas (,).

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to write name of month in a cell

    Alan,

    Not sure if that is the problem, it depends on the regional settings, but ; is used instead of commas sometimes. Denmark and other European and South American countries tend to use those regional settings more often.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: VLOOKUP to write name of month in a cell

    @NBVC
    Got it. Thanks. Hindsight, I think you solved in your first post. Missed that he had a range and not a single cell for the criteria.

    Alan

  7. #7
    Registered User
    Join Date
    05-04-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    30

    Re: VLOOKUP to write name of month in a cell

    Sorry, but none of the suggestions seems to work.

    And yeah, in danish Excel we use semi-colon in formulas.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to write name of month in a cell

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VLOOKUP to write name of month in a cell

    Why don't you just have this in B14 (if the first 12 worked)

    =B14

    dragged down to B49

    But making a minor change to NBVC's formula in Post 2 should solve your problem

    He gave you
    =VLOOKUP($A$2;Sheet1!$A$2:$B$13;2;FALSE)
    and should have been
    =VLOOKUP($A2;Sheet1!$A$2:$B$13;2;FALSE)
    (removed $ in front of 2 for the lookup value)
    Last edited by Cutter; 01-11-2011 at 03:08 PM. Reason: misread question

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VLOOKUP to write name of month in a cell

    If the months January-December are listed on Sheet1 in B2:B13, then my formula placed anywhere on sheet2, then copied down, then the INDEX() formula I gave should display those months in a cycle. Try it again.

    ========
    NOTE: If you're just trying to get Jan-Dec to appear sequentially for as long as you copy down, Excel will do that on its own.

    1) Type January in a cell
    2) Grab the bottom right corner of that cell and drag down...the other months will appear on their own

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to write name of month in a cell

    Quote Originally Posted by Cutter View Post

    But making a minor change to NBVC's formula in Post 2 should solve your problem

    He gave you
    =VLOOKUP($A$2;Sheet1!$A$2:$B$13;2;FALSE)
    and should have been
    =VLOOKUP($A2;Sheet1!$A$2:$B$13;2;FALSE)
    (removed $ in front of 2 for the lookup value)
    Thanks Cutter

  12. #12
    Registered User
    Join Date
    05-04-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    30

    Re: VLOOKUP to write name of month in a cell

    Thanks for the help guys, but I can't spend another minute on this problem now, I have an exam tomorrow, and I'm not even sure that I'll need this specific knowledge.

    Anyways, I solved it with another formula. I have another sheet with a full date (ddmmyyyy) so I solved it with

    Please Login or Register  to view this content.
    But again, thanks for helping, I'll study it closer when I have the time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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