+ Reply to Thread
Results 1 to 6 of 6

How to extract conditionally-formatted "highlighted" cell data

  1. #1
    Forum Contributor
    Join Date
    03-11-2018
    Location
    Tampa, Florida
    MS-Off Ver
    365
    Posts
    105

    How to extract conditionally-formatted "highlighted" cell data

    I have a workbook with 2 sheets. Sheet2 is imported data. Sheet1 is Sheet2 data used in various functions. It is also conditionally-formatted to return a highlighted cell.

    I would like to be able to search for highlighted cells in any given row of data and return the cell value and column heading.

    I tried using Ctrl+F with the pattern type selected. No luck. I have no clue if this is even doable using Excel functions or VBA code.

    A small sample workbook is attached. Any suggestions are appreciated!
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: How to extract conditionally-formatted "highlighted" cell data

    Your RANK formulae (e.g. this in B2: =RANK(Sheet2!B2,Sheet2!B2:B8,1) ) are using ranges which will adjust when copied down. Is this what you want? It would be more usual to use this:

    =RANK(Sheet2!B2,Sheet2!B$2:B$8,1)

    so that when you copy it down the range remains the same.

    As your CF condition is looking for the Top 1, then you can use the MAX function to determine if the value should be displayed, e.g. in C21:

    =IF(VLOOKUP(INDIRECT($C$19),$A$2:$D$8,COLUMNS($A:B),0)=MAX(B$2:B$8),B$1,"")

    and in C22:

    =IF(VLOOKUP(INDIRECT($C$19),$A$2:$D$8,COLUMNS($A:B),0)=MAX(B$2:B$8),VLOOKUP(INDIRECT($C$19),$A$2:$D$8,COLUMNS($A:B),0),"")

    Copy these across to the next two columns.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    03-11-2018
    Location
    Tampa, Florida
    MS-Off Ver
    365
    Posts
    105

    Re: How to extract conditionally-formatted "highlighted" cell data

    Quote Originally Posted by Pete_UK View Post
    Your RANK formulae (e.g. this in B2: =RANK(Sheet2!B2,Sheet2!B2:B8,1) ) are using ranges which will adjust when copied down. Is this what you want? It would be more usual to use this:

    =RANK(Sheet2!B2,Sheet2!B$2:B$8,1)

    so that when you copy it down the range remains the same.

    As your CF condition is looking for the Top 1, then you can use the MAX function to determine if the value should be displayed, e.g. in C21:

    =IF(VLOOKUP(INDIRECT($C$19),$A$2:$D$8,COLUMNS($A:B),0)=MAX(B$2:B$8),B$1,"")

    and in C22:

    =IF(VLOOKUP(INDIRECT($C$19),$A$2:$D$8,COLUMNS($A:B),0)=MAX(B$2:B$8),VLOOKUP(INDIRECT($C$19),$A$2:$D$8,COLUMNS($A:B),0),"")

    Copy these across to the next two columns.

    Hope this helps.

    Pete
    Thanks Pete! Your formulas work quite well. Followup question: Is it be possible to grab the (nth) Max numbers in a column? Such as the 2 highest or 3 highest?

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: How to extract conditionally-formatted "highlighted" cell data

    Instead of using MAX you can use the LARGE function, as in:

    LARGE(B$2:B$8,2) and LARGE(B$2:B$8,3)

    Hope this helps.

    Pete

  5. #5
    Forum Contributor
    Join Date
    03-11-2018
    Location
    Tampa, Florida
    MS-Off Ver
    365
    Posts
    105

    Re: How to extract conditionally-formatted "highlighted" cell data

    Quote Originally Posted by Pete_UK View Post
    Instead of using MAX you can use the LARGE function, as in:

    LARGE(B$2:B$8,2) and LARGE(B$2:B$8,3)

    Hope this helps.

    Pete

    Works like a charm. Thanks again Pete.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: How to extract conditionally-formatted "highlighted" cell data

    You're welcome - thanks for the rep.

    Pete

+ 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. How to get only "Sunday" highlighted in a series of dates in "cloumns"
    By Anuru in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-20-2014, 02:56 AM
  2. Replies: 1
    Last Post: 03-27-2014, 08:57 PM
  3. [SOLVED] How to convert "26:38:00" to "26:38" when the cell is formatted as Time?
    By PistachioPedro in forum Excel General
    Replies: 2
    Last Post: 11-15-2013, 06:49 PM
  4. [SOLVED] Conditionally format dates for "This week" AND "This month"?
    By Vermilion in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2012, 09:20 AM
  5. Replies: 5
    Last Post: 09-19-2008, 04:02 PM
  6. [SOLVED] In Excel a cell formatted "currency" shows "######" help!
    By llveda in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-07-2006, 04:40 PM
  7. [SOLVED] cells formatted to tick when text value "Y" if or null if "N"
    By Jay in forum Excel General
    Replies: 7
    Last Post: 01-13-2006, 05:20 AM

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