+ Reply to Thread
Results 1 to 12 of 12

Possible to apply conditional formatting across multiple ranges?

  1. #1
    Registered User
    Join Date
    11-04-2017
    Location
    uk
    MS-Off Ver
    MS 365
    Posts
    23

    Possible to apply conditional formatting across multiple ranges?

    I have several ranges of data, each range is identically sized as they are slightly different calculations on the same data. I would like to apply conditional formatting to highlight the highest and lowest values between the cells at the same relative position in each range.

    I have been able to do it with two ranges using the following formulas '=AND(ISNUMBER(B4),B4<B14)' & '=AND(ISNUMBER(B4),B4>B14)'
    but not sure how I would go about it with 3 or more ranges.

    I've attached a sample showing what I hope to be able to achieve

    Any help appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,255

    Re: Possible to apply conditional formatting across multiple ranges?

    Select entire range B4:G31;
    Conditional formatting menu, select color scale , select color pattern option (the first pattern looks just like yours).

  3. #3
    Registered User
    Join Date
    11-04-2017
    Location
    uk
    MS-Off Ver
    MS 365
    Posts
    23

    Re: Possible to apply conditional formatting across multiple ranges?

    Quote Originally Posted by Estevaoba View Post
    Select entire range B4:G31;
    Conditional formatting menu, select color scale , select color pattern option (the first pattern looks just like yours).
    That doesn't work how I want it to unfortunately, that just compares all the cells to each other. I need it to compare the cells at the same relative references from each range.

  4. #4
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Possible to apply conditional formatting across multiple ranges?

    hi plasteredric, try below to highlight the smallest number within each range

    conditional range = B4:G31

    conditional formula = AND(ISNUMBER(B4),B4=SMALL(OFFSET($B$4:$G$31,SUM(ROUNDDOWN((ROW()-ROW($B$4))/10,0))*11,SUM(ROUNDDOWN((COLUMN()-COLUMN($B$4))/6,0)),8,6),1))

    thereafter you can create more conditional formula by changing the rank (highlighted in red), good luck!
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Possible to apply conditional formatting across multiple ranges?

    I am not sure I have the concept. My proposal "apes" what you show.

    With a named array constant in Name Manager (TheVals)
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and these in Format Manager:

    Apply these to range B4:G11 initially.
    Red:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

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


    Then select B4:G11 and click Format Painter and apply to B14 and B24.
    Dave

  6. #6
    Registered User
    Join Date
    11-04-2017
    Location
    uk
    MS-Off Ver
    MS 365
    Posts
    23

    Re: Possible to apply conditional formatting across multiple ranges?

    Quote Originally Posted by FlameRetired View Post
    I am not sure I have the concept. My proposal "apes" what you show.

    With a named array constant in Name Manager (TheVals)
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and these in Format Manager:

    Apply these to range B4:G11 initially.
    Red:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

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


    Then select B4:G11 and click Format Painter and apply to B14 and B24.
    That doesn't seem to give the result i require, i've attached a revised sheet with different numbers and the expected results, might make it a bit clearer.

    I need it t work like this,

    Cell B4 = 1 (Highlight Red)
    Cell B14 = 2 (Highlight Tan)
    Cell B24 = 3 (Highlight Green)

    Then,

    Cell C4 = 2 (Highlight Tan)
    Cell C14 = 3 (Highlight Green)
    Cell C24 = 1 (Highlight Red)

    repeated all the way through to,

    Cell G11 = 5 (Highlight Green)
    Cell G21 = 1 (Highlight Red)
    Cell G31 = 3 (Highlight Tan)
    Attached Files Attached Files
    Last edited by plasteredric; 11-23-2017 at 09:33 AM.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Possible to apply conditional formatting across multiple ranges?

    Aha! And yikes! LOL I suspected I was oversimplifying it. This will take me some time.

  8. #8
    Registered User
    Join Date
    04-25-2013
    Location
    Llangollen, Wales
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Possible to apply conditional formatting across multiple ranges?

    X posted here: http://www.vbaexpress.com/forum/show...ultiple-ranges

    I've posted a solution there!

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Possible to apply conditional formatting across multiple ranges?

    I couldn't examine the file at the link posted by paulked. I don't have an account there. And oh yes. Please don't cross-post again.

    In the attached find these named formulas in Name Manager:
    TheDat
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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


    Then find these 3 rules in Format Manager:
    Red:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

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


    This whole setup depends upon future files maintaining the integrity of Range names format. COUNTIF needs it.

    It also depends upon all Ranges sharing only one multi-column range. IE there are no Ranges to the right of these targets.
    Last edited by FlameRetired; 11-23-2017 at 07:30 PM.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Possible to apply conditional formatting across multiple ranges?

    Quote Originally Posted by plasteredric View Post
    I have several ranges of data
    Your post does not comply with Rule 8 of our Forum Rules: Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you must provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (most other forums have the same rule).
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  11. #11
    Registered User
    Join Date
    04-25-2013
    Location
    Llangollen, Wales
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Possible to apply conditional formatting across multiple ranges?

    Here's my post from VBAExpress (as the OP was not happy with multiple conditional formats):
    Code in Sheet1 Object

    Please Login or Register  to view this content.

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

    Re: Possible to apply conditional formatting across multiple ranges?

    First, format all with Tan. Then there are 2 criterias left: min and max.
    Stay in B4:
    1/ Define which range of the cell (range A, B or C):
    SUMPRODUCT(--ISTEXT(Sheet1!$B$3:$B4))=1
    If stay in B14, it returns 2, because it found 2 cells of text in B3:B14. Stay in B24, = 3

    2/ Define distance from B4 to other 2 relation cells then move to get those values:
    OFFSET(Sheet1!B4,IF(SUMPRODUCT(--ISTEXT(Sheet1!$B$3:$B4))=1,{10,20},IF(SUMPRODUCT(--ISTEXT(Sheet1!$B$3:$B4))=2,{-10,10},{-10,-20})),)
    positive: go down; negative: go up
    If active cell is in Range A, go down 10 & 20 rows to get other 2 cells
    If active cell is in Range B, go up 10 & down 10 rows to get other 2 cells
    ...

    3/Define MIN value of the other 2 cells:
    Use define name:
    MinPos
    = MIN(OFFSET(Sheet1!B4,IF(SUMPRODUCT(--ISTEXT(Sheet1!$B$3:$B4))=1,{10,20},IF(SUMPRODUCT(--ISTEXT(Sheet1!$B$3:$B4))=2,{-10,10},{-10,-20})),))

    4/ Conditional Formating formular for MIN value of cell B4:
    =AND(B4<>"",B4=MIN(B4,MinPos))

    Repeat step 3 and 4 for Max Value (use name MaxPos)

    Hope it helps.
    Attached Files Attached Files
    Last edited by bebo021999; 11-26-2017 at 10:42 PM.
    Quang PT

+ 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. Apply conditional formatting formula to two dynamic ranges?
    By excelfriend1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2016, 02:03 PM
  2. [SOLVED] How To Apply Conditional Formatting to Multiple Worksheets?
    By taylorsm in forum Excel General
    Replies: 1
    Last Post: 06-08-2016, 12:27 PM
  3. Conditional Formatting from 1 Row and apply to multiple rows
    By emondragon07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2015, 09:16 PM
  4. Apply conditional formatting to differed filtered ranges
    By wayneknox01 in forum Excel General
    Replies: 2
    Last Post: 02-09-2015, 08:41 PM
  5. Replies: 2
    Last Post: 11-27-2014, 10:31 AM
  6. [SOLVED] Apply Conditional Formatting to Multiple Columns
    By vinceancona in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-31-2013, 04:49 PM
  7. [SOLVED] Conditional Formatting Apply to multiple Cells
    By ganesh81289 in forum Excel General
    Replies: 4
    Last Post: 06-22-2012, 11:08 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