+ Reply to Thread
Results 1 to 6 of 6

Finding the last column using MATCH

  1. #1
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Asia
    MS-Off Ver
    Microsoft 365
    Posts
    234

    Finding the last column using MATCH

    Hi, I have a row with text in it. I would like to find the last column that has the text "up". Sometimes the columns will contain #N/A due to vlookup formula. Could you pls help me with the formula? thanks

    File attached.
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Finding the last column using MATCH

    Does it has to be with MATCH function?
    Because with LOOKUP is quite easy.

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

  3. #3
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Asia
    MS-Off Ver
    Microsoft 365
    Posts
    234

    Re: Finding the last column using MATCH

    Thanks. This works. Could you pls explain why you have "2" and "1/" in the formula? I need to modify it to other parts of the spreadsheet.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Finding the last column using MATCH

    As you can see, 2 and 1/ are constants so they don't need to be changed for other parts.
    What you change are vectors and criteria.
    To understand this first you need to know how LOOKUP formula works.

    This is syntax:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In this case LOOKUP function looks in a one-row or one-column range (known as a vector) for a value (lookup_value) and returns a value from the same position in [result_vector] a second one-row or one-column range.

    If the LOOKUP function can't find the lookup_value, the function matches the largest value in lookup_vector that is less than or equal to lookup_value.

    If such doesn't exist it will return LAST value in a column.

    We are searching for value 2 in array 1/(A1:Z1="up")
    (A1:Z1="up") will evaluate TRUE/FALSE values depending are they equal to "up" or not.

    In your example it will look like this:
    Please Login or Register  to view this content.
    1/TRUE is 1 and 1/FALSE is error (same as 1/0).

    Therefore you matching number 2 (notice that you can use here ANY number BIGGER than 1) in the array:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Since it can't find 2 it return last value that is red 1.

    If you use this formula result will be 1.
    If you add [result_vector] you will get solution at that POSITION.

    In this case 10 because (you can follow this by click EVALUATE FORMULA in FORMULA TAB):

    Please Login or Register  to view this content.

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

    Re: Finding the last column using MATCH

    Here is another possible way using MATCH
    This returns the column number that contains the last occurrence of "UP".
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If the row was of unknown length, you can use this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The 1:1 actually refers to row 1. If you were looking in row 4 the reference would be 4:4
    If you want the column letter this will return that but you can see it is very much more involved.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Here is a spreadsheet to play with
    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

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Finding the last column using MATCH

    This will give you shorter version instead of choose.
    And it's not limited up to Z column.

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

+ 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. [SOLVED] Finding intersection value of specific row and column that match a certain value
    By Nikox9 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2016, 02:48 AM
  2. [SOLVED] Subtracting from different worksheets & finding the "last" match in column
    By Michelle Slayton in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-02-2014, 12:29 PM
  3. Excel 2013, finding match in cell from range (column)
    By Rob de QUartel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2014, 05:58 AM
  4. Replies: 13
    Last Post: 05-11-2014, 06:51 PM
  5. [SOLVED] Finding a partial match within a column
    By kestefon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-14-2013, 02:14 PM
  6. [SOLVED] Finding a match in part of a column
    By j_Southern in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-10-2013, 07:42 AM
  7. Replies: 4
    Last Post: 02-19-2013, 02:19 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