+ Reply to Thread
Results 1 to 6 of 6

Find last column in sheet where a string exists in any row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Find last column in sheet where a string exists in any row

    Hi All,

    Looking for a formula to identify the last column number (reading left to right) where a specific string exists within any row of that column. The columns are labelled by date (i.e. A = 01/01/2015 B = 02/01/2015 etc.) the string in question could exists in any row of that column.

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,937

    Re: Find last column in sheet where a string exists in any row

    Please attach a sample excel file
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: Find last column in sheet where a string exists in any row

    I have attached a very simplified model for you.

    Column A contains names (irrelevant for now)
    Row 1 Contains dates.

    I have populated a Dummy Task (TASK A) that I would need to identify the last column number it exists in. In the attached file I would expect an answer of 9 (column I) as that is the last column where TASK A exists.

    hope this helps!
    Attached Files Attached Files

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,937

    Re: Find last column in sheet where a string exists in any row

    or try below array formula (Confirm with Ctrl+Shift+Enter)
    =MAX(IF($B$2:$I$11=M$2,COLUMN($B$2:$I$11)))
    =MAX(IF($B$2:$I$11=M$2,COLUMN($B$2:$I$11)))

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,937

    Re: Find last column in sheet where a string exists in any row

    =SUMPRODUCT(MAX(($B$2:$I$11=M$2)*COLUMN($B$2:$I$11)))
    =SUMPRODUCT(MAX(($B$2:$I$11=M$2)*COLUMN($B$2:$I$11)))
    Try this

  6. #6
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: Find last column in sheet where a string exists in any row

    Thank you so much!

    both methods work perfectly on the dummy data - is there a performance advantage of one over the other as the live data is significantly larger.

+ 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: 6
    Last Post: 11-13-2015, 07:36 AM
  2. Replies: 4
    Last Post: 03-30-2015, 03:20 PM
  3. How to find a Text exists in a column or not
    By Kandavalli.Kiran in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-12-2015, 10:46 AM
  4. [SOLVED] Find string in column and paste corresponding row into other sheet
    By cronerd in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-28-2013, 01:21 AM
  5. how to find Certain String in a column, select/Copy the cell till another String
    By excelkeechak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-18-2009, 10:59 AM
  6. How we can find that whether a particular column exists in the Excel file or not
    By Progress2007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2008, 12:01 PM
  7. find values exists in sheet
    By krishnarao in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2007, 02:10 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