+ Reply to Thread
Results 1 to 7 of 7

Return Column Letter based on condition

  1. #1
    Registered User
    Join Date
    11-18-2014
    Location
    Uganda
    MS-Off Ver
    2013
    Posts
    25

    Question Return Column Letter based on condition

    Hi Forum,

    I have been trying to find a forumla-only way (unable to make use of VBA due to policy) to return the column letter based on last cell that is not blank.

    Example:
    Example.PNG


    Appreciate any help that may be provided.

    Cheers.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Return Column Letter based on condition

    This wont return the column letter, but it should return the heading...
    =INDEX($a$1:$d$1,MATCH(0,a2:d2,-1))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Return Column Letter based on condition

    Try in E2:
    Please Login or Register  to view this content.
    Quang PT

  4. #4
    Registered User
    Join Date
    11-18-2014
    Location
    Uganda
    MS-Off Ver
    2013
    Posts
    25

    Re: Return Column Letter based on condition

    Quote Originally Posted by FDibbins View Post
    This wont return the column letter, but it should return the heading...
    =INDEX($a$1:$d$1,MATCH(0,a2:d2,-1))
    Thank you so much! This workaround is perfect.

    I had something similiar but only after looking at your solution have I realised I had been Indexing incorrectly. Anyhow, once again thank you.

  5. #5
    Registered User
    Join Date
    11-18-2014
    Location
    Uganda
    MS-Off Ver
    2013
    Posts
    25

    Re: Return Column Letter based on condition

    Quote Originally Posted by bebo021999 View Post
    Try in E2:
    Please Login or Register  to view this content.
    WOW! This is great as well, thanks for the input.

    Just quickly, would be able to explain how this works by any chance?

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Return Column Letter based on condition

    Quote Originally Posted by SteveTheFish View Post
    WOW! This is great as well, thanks for the input.

    Just quickly, would be able to explain how this works by any chance?
    LOOKUP found last date and returned column index

    ADDRESS returned address, likes "D1"

    SUBTITUTE returns "D"

    =SUBSTITUTE(ADDRESS(1,LOOKUP(10^6,$A2:$D2,COLUMN($A2:$D2)),4),1,"")

  7. #7
    Registered User
    Join Date
    11-18-2014
    Location
    Uganda
    MS-Off Ver
    2013
    Posts
    25

    Re: Return Column Letter based on condition

    Quote Originally Posted by bebo021999 View Post
    LOOKUP found last date and returned column index

    ADDRESS returned address, likes "D1"

    SUBTITUTE returns "D"

    =SUBSTITUTE(ADDRESS(1,LOOKUP(10^6,$A2:$D2,COLUMN($A2:$D2)),4),1,"")

    Thank you very much for doing that. Cheers.

+ 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. Need formula to return column letter
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 03-18-2016, 10:01 AM
  2. [SOLVED] VBA to return the Column LETTER NOT Number
    By lday75 in forum Excel General
    Replies: 5
    Last Post: 07-25-2012, 10:33 AM
  3. Replies: 4
    Last Post: 07-18-2012, 08:54 PM
  4. VBA: Return the Column Letter Heading
    By BigBas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2007, 06:21 AM
  5. column command to return letter
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-11-2006, 03:09 PM
  6. Column() to return a letter instead of a number?
    By cKBoy in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-17-2006, 12:55 AM
  7. Replies: 2
    Last Post: 05-09-2005, 04:06 PM

Tags for this Thread

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