+ Reply to Thread
Results 1 to 6 of 6

Automatic Converting of Cells Into Range Notation and Conditional Formatting

  1. #1
    Registered User
    Join Date
    08-31-2021
    Location
    Cambridge, England
    MS-Off Ver
    Office 365
    Posts
    11

    Automatic Converting of Cells Into Range Notation and Conditional Formatting

    Cross-posted at https://www.mrexcel.com/board/thread...tting.1213810/

    I am conditionally formatting large numbers of cells using lists such as A1, A2, A3, B1, B2 & B3. These cells can often be shortened by using range notation - so the list of cells shown could be shortened to A1:B3.

    My questions are:
    (a) Will spreadsheets work quicker if they are given data that is specified as a range as opposed to individual lists of cells?
    (b) Is there a way of processing lists of cells (such as my A1, A2, A3, B1, B2 and B3) so they are automatically converted into the range notation? (Does this exist?!)

    Thank you for any comments - it is much appreciated!
    Last edited by 6StringJazzer; 08-16-2022 at 08:59 PM.

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

    Re: Automatic Converting of Cells Into Range Notation and Conditional Formatting

    a) I don't know for certain and I don't know of anybody that has conducted empirical tests. However, I know a little about how software is written. There are two parts to executing a formula. The first part is parsing the formula. It is faster to parse a range expression than a list of cells. But the difference is so tiny that you would never detect it unless you had maybe a million formulas. Maybe not even then. Once it is parsed to some canonical form (which I am assuming that Excel does, because all good optimized compilers do that) then the second part, the processing time, will be the same.

    Bottom line is that (usually) you should write formulas in such a way that they are clear and understandable before you worry about optimizing for performance. An exception to this will be array formulas, which can take very long to execute if they are not carefully constructed.

    b) No. You could probably write some custom VBA do this but you would basically be writing a parser and it is probably not worth the effort (see a).

    I would like to see what your actual conditional formatting is, so we can talk in concrete terms about your particular file.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

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

    Re: Automatic Converting of Cells Into Range Notation and Conditional Formatting

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    I have edited your post to add this because you have fewer than 10 posts. But please take the time to review our rules. There aren't many, and they are all important.

  4. #4
    Registered User
    Join Date
    08-31-2021
    Location
    Cambridge, England
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Automatic Converting of Cells Into Range Notation and Conditional Formatting

    Thank you Jeff for taking the time to post - I really appreciate it.

    I am conditionally formatting cells so a specified set of cells change their fill colour based on a formula. The cells make a pixel art image so there are plenty of pixels e.g. (120 by 120). I don't go bigger than 150 by 150 pixels, although I have seen other persons that do! Over the past year, I have observed that the amount of cells being formatted at any one time has a noticeable effect on the time Excel takes to update the image.

    I am in the process changing my method of formatting by revealing different size squares on the picture instead of just individual cells - hence there are now also ranges to consider.

    I think if you have the opinion that specifying ranges in the formatting as opposed to individual cells will make minimal difference then I will not work on finding ways of submitting ranges!

    Thank you again!

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

    Re: Automatic Converting of Cells Into Range Notation and Conditional Formatting

    Like I said, I would like to see your actual conditional formatting rules. You can attach a file (see yellow banner at the top of the page), or at least show your conditional formatting rule(s).

    14,400 is a solid number but still within reason.

  6. #6
    Registered User
    Join Date
    08-31-2021
    Location
    Cambridge, England
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Automatic Converting of Cells Into Range Notation and Conditional Formatting

    Hi - I thought I would follow this up because I have noticed that Excel automatically converts any cells provided into ranges when conditional formatting via VBA. I note that when I tried to do this manually the conversion was not taking automatically taking place (hence I asked this question.)

    This is brilliant news for me, as I have kept working with just the individual cells which has also meant the coding is much easier. (So thank you Jeff for your comments as they have proven to be most helpful!)

    The only other issue that I came across is when variables are expressed as "ranges" (e.g. Dim rng As range) they are not allowed to store more than 255 characters. Fortunately, I have solved this now.

    Apologies about my cross-posting. I hope I can still post on this board from time to time!
    Last edited by ajarmstron; 08-18-2022 at 07:01 PM.

+ 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. Conditional Formatting a range of cells based on a range of cells on another sheet.
    By operationsahcc in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-13-2020, 05:47 AM
  2. Can I use Cells notation to state a value of a range?
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-29-2017, 11:16 AM
  3. Automatic conditional formatting to cells with text
    By banaanas in forum Excel General
    Replies: 1
    Last Post: 10-17-2014, 12:49 AM
  4. Replies: 1
    Last Post: 08-31-2014, 03:38 PM
  5. Replies: 2
    Last Post: 11-19-2012, 08:36 PM
  6. Replies: 1
    Last Post: 04-09-2009, 06:10 AM
  7. Selecting a range of cells with R1C1 notation
    By gshock in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2008, 04:13 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