+ Reply to Thread
Results 1 to 11 of 11

Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

  1. #1
    Registered User
    Join Date
    02-17-2011
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Good day.

    I have managed to get my named range "Data_Range_1" to equal $E2:$H2 (only columns are locked) but when I try to use the "Data_Range_1" named range in a conditional formatting formula, it does not work as intended - it seems to revert back to $E$2:$H$2, based on what I can see with the cells being highlighted in the range.
    Please Login or Register  to view this content.
    My pivot table changes, based on the category selected in a slicer, so I need the conditional formatting range (with only the column locked) to dynamically change with it, which it is not, despite the Data_Range_1 value being what I want it to be.

    I have been searching hours for a solution without any luck...

    Any assistance in this matter will be greatly appreciated.

    Kind Regards,
    Jason
    Last edited by FDibbins; 05-17-2018 at 11:25 AM.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Hi,
    Conditional formatting using relative addressing is generally buggy in VBA unless you select the range to which you are applying the CF first, so I would start with that.

    If it still doesn't work, then please post a sample workbook.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    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,945

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Jason, welcome to the forum

    Hoe gaan dit daar doer in die Kaap? PE old boy here from Klerksdorp, now living in USA, son lives in CT, sister in Durbs

    Code Tags Added
    Please note that your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    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

  4. #4
    Registered User
    Join Date
    02-17-2011
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Apologies, FDibbins. Alles gaan lekker hier in die Kaap.

    This is my first post ever in a forum - I am usually able to find solutions to my Excel problems.

    I will ensure that I use the [CODE] tags in future.

    Regards from Cape Town.

  5. #5
    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,945

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    No problem, Jason, we all have to start somewhere

  6. #6
    Registered User
    Join Date
    02-17-2011
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Hi xlnitwit.

    I am basically looking for a way to highlight the lowest value in a pivot table row, across columns, e.g. $A1:$D1, where the $D1 will constantly change, based on the slicer item selected.

    This does not need to be done via Conditional Formatting, e.g. I see that one can highlight the lowest value per column, using Application.WorksheetFunction.Max(rng).

    Kind Regards,
    Jason

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Did you try amending the code to just select the first row of the pivot table data before applying the CF?

  8. #8
    Registered User
    Join Date
    02-17-2011
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Hi xlnitwit.

    Yes, I did but it did not fix the issue. I have attached an example worksheet. The conditional formatting in the worksheet is correct at present but as soon as I change the Category, the Data_Range_1 refers to range becomes incorrect.

    Any help will be much appreciated.

    The macro is included but I also copied an example into a separate worksheet in the workbook, just in case.

    Regards,

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Perhaps this
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-17-2011
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    Genius!

    Thanks so very much xlnitwit - I truly appreciate it.

    Works like a charm :-)

  11. #11
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Formula in Conditional Formatting in the format $A2:$D2 (only columns locked)

    You're welcome.

+ 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: 4
    Last Post: 09-04-2016, 10:02 AM
  2. Conditional formatting use a formula to determine which cells to format
    By aaslezak in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-02-2015, 05:00 PM
  3. Replies: 5
    Last Post: 05-25-2014, 12:12 AM
  4. [SOLVED] Conditional Formatting to Use a formula to determine which cells to format
    By kenadams378 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 05-16-2013, 10:29 AM
  5. Replies: 3
    Last Post: 08-04-2012, 07:22 PM
  6. [SOLVED] Format Cell that hold a formula using a UDF and Conditional formatting
    By CliffB382 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2012, 01:55 PM
  7. Changing Text Format with Formula or Conditional Formatting with multiple values
    By gerodr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2011, 08:54 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