+ Reply to Thread
Results 1 to 7 of 7

Conditionnal formatting with reference to an array

  1. #1
    Registered User
    Join Date
    04-10-2015
    Location
    France
    MS-Off Ver
    2013
    Posts
    3

    Conditionnal formatting with reference to an array

    Hi there,

    First post for me in this forum!

    I have a problem trying to apply a conditionnal formatting that contains a reference to a named array.
    See the attached MWE: the conditionnal formatting formula (applied to cells C1:C20) refers to the range named "Range1" (A1:A6) and everything works fine. But if, in the formatting formula, the "Range1" is changed to the array "Array1" (that corresponds to the exact same range of cells as "Range1" in the worksheet), an error message pops up.
    Can anyone help? Or is this simply the normal behaviour?

    Matt

    CondtionnalFormattingArrayMWE.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Conditionnal formatting with reference to an array

    welcome to the forum!

    array1 is the name of the table, so you have to call it a little differently. looks like this is working:

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


    http://www.get-digital-help.com/2012...ting-formulas/
    Hope I could help - if your post has been solved don't forget to mark it as such.

    Clicking the * below is a great way to say thanks!

    "Drowning in 10 feet of water isn?t any different than drowning in a million feet. And if you can swim, it doesn?t matter how deep the ocean is. At some level, once you realize you?re in water that?s too deep to stand, you have to have a very different approach," - Joi Ito

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Conditionnal formatting with reference to an array

    Hi Matt and welcome to the forum,

    Simarui is correct but how did s/he know? Look at your Names Manager in the Formulas Tab and the Icon to the left of the Named Range. This shows what kind of range is being named.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    04-10-2015
    Location
    France
    MS-Off Ver
    2013
    Posts
    3

    Re: Conditionnal formatting with reference to an array

    Hi simarui and MarvinP,

    Thank you very much for your help, it indeed works very well now, both in the MWE and in my actual worksheet.

    Now, this triggers another question: suppose for some reason, the table name is modified by some unaware user. Is it possible to dynamically change the name in the string? I.e. is it possible to convert a table name to a string? Or I am nitpicking?

    Matt

    @MarvinP: Yes, and what I called "array" is actually a table in the English version (my Excel is in French). If I had known that earlier, maybe I could have find the solution myself :-)

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Conditionnal formatting with reference to an array

    Hey Matt,

    I was wondering this type of question also a few days back. I was pleasantly surprised to see my formulas reflected the changing of the named ranges. My only answer to you is to "Try it" and see if changing a name in the names manager is reflected in all formulas that use that name.

    That being said, I don't think a fixed VBA code name will be discovered and changed by using the Names Manager and changing the name of a range.

  6. #6
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Conditionnal formatting with reference to an array

    unfortunately the conditional formatting input is not really a name, but a string which prompts indirect() to go find the range called by the string... at least in my test it did not work to change the name of the table...

    but, you can name a range and define it as =Array1[[#All],[Colonne1]], then reference the named range in your conditional formatting as before, and then it will adjust for everything...

  7. #7
    Registered User
    Join Date
    04-10-2015
    Location
    France
    MS-Off Ver
    2013
    Posts
    3

    Re: Conditionnal formatting with reference to an array

    Hi MarvinP and simarui,

    Yes, changing the name in the Name Manager has an effect "only" on the formulas (which is great) but unfortunately it does not affect the string corresponding to that name.

    @simarui: this is very neat! I'll do that on Monday morning.

    Anyway, the main problem has been very efficiently solved.
    Ladies/gentlemen, once again thanks for your help.

    Matt

+ 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. Table Formatting and Conditionnal formatting
    By bimo in forum Excel General
    Replies: 1
    Last Post: 01-15-2014, 06:45 AM
  2. [SOLVED] 1 question about conditionnal formatting
    By Askalian in forum Excel General
    Replies: 1
    Last Post: 05-14-2013, 05:30 PM
  3. Auto shape conditionnal formatting
    By Skell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2012, 01:45 PM
  4. [SOLVED] Conditionnal Formating Help
    By Julien FROGER in forum Excel General
    Replies: 3
    Last Post: 01-04-2006, 11:45 AM
  5. Add value to conditionnal formatting
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2005, 04:05 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