+ Reply to Thread
Results 1 to 3 of 3

Conditional Formatting with a Dynamic Range

  1. #1
    Registered User
    Join Date
    09-22-2010
    Location
    California
    MS-Off Ver
    Office 2007
    Posts
    13

    Conditional Formatting with a Dynamic Range

    We have a list of units in Column A that are going to be renamed to whatever is listed in the adjacent cell of column B.

    We can rename our units in bulk using a separate utility, but need to make sure that when we do so, no two units ever have duplicate values.

    The units to be renamed come in to us in random order so the first thing we did was sort by what the new unit numbers will be (column B).

    I would like to set up conditional formatting so that we know where to stop as we bulk rename our units.

    For example, we can bulk rename units listed in rows 2 through 11 without a problem because it doesn't matter what order our renaming utility does it in. However, if we included row 12 in the mix, then there's a chance the utility would rename Unit D to H (Row 12) before the Unit H (from row 5) had been changed to W and we'd have two H's.

    So, I'm trying to create conditional formatting that will show stopping points for each bulk rename that we need to do. In the example I'm providing, it would highlight Row 12 to indicate a stopping point. After this is where it gets tricky. It then needs to start looking at a new (dynamic?) range based off of where we had last identified a stopping point.

    In other words, there's no reason for Row 13 to be highlighted anymore as we will assume that cells from rows 2-11 have all been renamed and the G (from row 7) will now be a T. Instead, the next row to be highlighted should be Row 16 where B can not be renamed to D until the D from row 12 has been renamed to H.

    Continuing this pattern we shouldn't see another highlight/stopping point until Row 31, and then again on row 35, and 37.

    To get what you see in the image, this is what I had used in the Formatting Rule:
    =IF(COUNTIF($A$1:A1,B1),"TRUE", "FALSE")
    Applied to: =$B:$BExcel.PNG

    Thanks in advance for any tips and/or suggestions.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Conditional Formatting with a Dynamic Range

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Conditional Formatting with a Dynamic Range

    If you don't mind using two helper columns, this should work:

    Use Column C (the helper column) to record when the change has been made, by putting a 'y' in C2, C3, etc.
    Then put this in D2 and drag down as far as you need:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now you can use this as your CF formula for col B:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    The formula in D2 works like this:
    • It counts the number of 'y' in column C and subtracts this from the number of entries in column B;
    • The result of this subtraction is used to calculate how many rows upwards the range for the CountIf should be offset from the reference cell, which is B2; it's multiplied by -1 because you want the offset to be above the reference cell;
    • The Indirect and Cell("address" parts are used to return the cell address of that offset cell;
    • The CountIf uses that address down to the current row in col A as its range, with the entry in col B as the criterion (just as with your current formula);
    • Lastly, the >0 part ensures that either True or False is returned.

    I think that will do what you want, but if it doesn't work on your real data then we'll need a sample file as Pepe notes above.
    If the explanation doesn't make sense and you want me to break it down a bit more then let me know.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

+ 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. Dynamic Conditional Formatting Range
    By caleocj in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-07-2019, 11:41 AM
  2. Conditional Formatting of a Dynamic Range VBA
    By nobodyukno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2015, 03:30 PM
  3. [SOLVED] Conditional Formatting Looking through dynamic range
    By NeoFlex in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-10-2013, 12:56 PM
  4. Conditional Formatting with Dynamic Range (No VBA)
    By kychang in forum Excel General
    Replies: 6
    Last Post: 05-23-2013, 01:53 AM
  5. Conditional formatting a dynamic range
    By springboardjg in forum Excel General
    Replies: 1
    Last Post: 06-21-2012, 04:42 PM
  6. Conditional formatting a dynamic range
    By gentles in forum Excel General
    Replies: 2
    Last Post: 12-06-2010, 09:16 PM
  7. Conditional Formatting & Dynamic Range
    By james in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-11-2005, 12:05 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