+ Reply to Thread
Results 1 to 11 of 11

Location of the last occurrence of month in range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Location of the last occurrence of month in range

    Hi -

    How do you find the last of occurrence of the month in Column A. Please see below print screen.

    Based on the print screen 3 is the location of the first occurence of January how about the last occurrence? what is the formula that I'm
    going to use?

    I've already tried =MATCH("January",A1:A22,1) but its giving me 22 which is suppose to be 8.

    Need help please

    Thank you

    untitled.JPG
    Last edited by Hudas; 02-24-2012 at 04:52 PM.

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

    Re: Location of the last occurrence of month in range

    Try:

    =MATCH(2,INDEX(1/(A1:A22="January"),0))
    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 Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Location of the last occurrence of month in range

    Hi

    Maybe this, will work for you.

    =MATCH(2;INDEX(1/(A1:A22="January");0))

    Change semi-colos, to gomma, if you have to do it.


    And, pls: Don't upload a picture. Upload a sample workbook.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Location of the last occurrence of month in range

    Its working!! Thank you both of you!!One more thing.. would you mind explaining your formula for me.. I just want to understand it please...

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Location of the last occurrence of month in range

    You are welcome!

    Teacher will do it! Iam just a (good i hope) student(and my English are not so good,for explanations, too)!!

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

    Re: Location of the last occurrence of month in range

    So, I gotta go now.. so not to leave you hanging....


    this part: (A1:A22="January")

    creates an array of TRUE/FALSE results....

    The 1/(A1:A22="January")

    divides 1 by each of the TRUEs and FALSEs...

    1/TRUE is like 1/1 and results in 1/(A1:A22="January") function without having to hit CTRL+SHIFT+ENTER since it technically is an ARRAY formula...

    so we get a result like MATCH(2,{1;1;1;1;#DIV/0;#DIV/0;#DIV/0;}) or similar...

    the MATCH function without the last Match_type argument allows you to find the last value that is smaller than or equal to the lookup value... so we are looking for a 2 amongst 1's and #DIV/0 errors... and the function ignores errors, so it goes to the last 1 in the array, and returns the corresponding position.

    You can use the formula evaluator found in the Formulas tab to step through it yourself to see it at work....
    1/FALSE is like 1/0 and results in #DIV/0! error

    the INDEX wrapped around that allows us to process that
    Last edited by NBVC; 02-25-2012 at 11:41 AM.

  7. #7
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Location of the last occurrence of month in range

    Thank you very much for the time for helping. I really really appreciate it!! Have a good day!!!

  8. #8
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Location of the last occurrence of month in range

    Hi - Is there any other way to reference the last of occurrence of the month in Column A with duplicate entrys? The above formula is working by itself but when I incorporate this unto the index function its giving me an error.

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

    Re: Location of the last occurrence of month in range

    Can you give an example of the raw data and what you want to extract?

  10. #10
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Location of the last occurrence of month in range

    Hi - I've actually posted a new thread for the index function because I think it is different topic after all here's the link, http://www.excelforum.com/excel-gene...85#post2717885 and still waiting for a response.. The attached file on these thread is my sample. I thought I could make it work myself but it turns out I cant.

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

    Re: Location of the last occurrence of month in range

    Okay, let's keep it separate then... I responded over there.

+ 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