+ Reply to Thread
Results 1 to 7 of 7

Conditional formatting range changes when cells are merged

  1. #1
    Registered User
    Join Date
    05-30-2016
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2010
    Posts
    7

    Conditional formatting range changes when cells are merged

    I am trying to setup a sheet I will use for working out staffing allocations in my school. I have a list of teachers. Below that I have, for each grade level, the collection of classes they'll need. Each class is represented by a merged group of cells, ie "Grade 12 Business Standard & Higher Level" requires 6 teaching periods, so I merged 6 cells and the cell content is "Grade 12 Bus SL/HL"

    Once I have set up all the necessary classes, I will drag each set of merged cells to the appropriate teacher. This then gives me a wonderful tool I can play around with to organise the teaching loads for next year. It's awesome! I have done this before, without conditional formatting, but I'd like to go one better this time, as otherwise I get annoyed when all the borders get messed up and I have to reformat from time to time.

    I have the conditional formats set up (based on cell content, ie finds the string " bus" then colours the merged cells and outlines them). And it works beautifully, and I even have formulae which work for multiple subjects (i.e. classes in the same department)
    Please Login or Register  to view this content.
    BUT

    When I try to do this for new cells, it highlights but then only puts the border around the left-hand cell of the merged group. And that is consistent if I move the cells, and if I save and reopen the file. And when I look at the cells the conditional formatting applies to - it is no longer for the entire sheet and the range has gone all weird.

    SO I fix it. I have defined a Name "Entire" which refers to the whole sheet. I replace the weird multiple ranges mess with =entire, it works perfectly, the formatting corrects, lovely.

    But then I merge some more cells, and voila - the problem is back again.

    I'm going to be doing a LOT of merging (and then moving) cells around on this sheet, I'd quite like this to work.
    1. Is this making sense?
    2. Can this be done through Conditional Formatting?
    3. Would it be better done through VBA and if so, how?

    I have attached a sample of this sheet if you want to take a look through it. This was created in Excel 2010.
    Note, the merged cells can currently be found at row 100 onwards
    Attached Files Attached Files
    Last edited by djmiles; 10-17-2016 at 08:56 AM. Reason: Added location of merged cells

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,174

    Re: Conditional formatting range changes when cells are merged

    I cannot see any merged cells in your file and lesson here is simple: Do not use merged cells as they cause too many problems- simple increase column width.

  3. #3
    Registered User
    Join Date
    05-30-2016
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2010
    Posts
    7

    Re: Conditional formatting range changes when cells are merged

    My bad - the merged cells are way down, they start at row 100. But eventually, they'll be dragged up to the top. That's the planning area down there, while I work out exactly what classes are needed.

    And merged cells are absolutely key to the whole concept, as it is vital that they span the required number of columns. 1 column = 1 teaching period, so a 5 period class NEEDS to have a 5-column merged cell. This enables me to ensure no teacher is assigned too many teaching periods.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,174

    Re: Conditional formatting range changes when cells are merged

    Putting aside the question of the use of merged cells, if VBA was a solution, how would you "allocate" a set of merged cells to a teacher and "period".

    It would suggest to me a fairly complex set of dynamic conditions/rules would need defining.

    Currently it appears to be a "drag and drop" exercise based on your knowledge which is not likely to be replicated in VBA,
    Last edited by JohnTopley; 10-17-2016 at 01:26 PM.

  5. #5
    Registered User
    Join Date
    05-30-2016
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2010
    Posts
    7

    Re: Conditional formatting range changes when cells are merged

    Really, the only coloring rules would be as follows

    If cell contains "Eng" or "SSST" assign color1 and a border
    If cell contains "Math" assign color2 and a border
    etc.

    There are 7 or 8 colour requirements, that's really it.

    It does actually work - or at least the coloring does. But the borders remain incomplete.

    So I'm guessing something done in VBA would simply update every time the sheet is changed. If having it check the whole sheet would be too time-consuming, it could check a much smaller area, about 50 columns by 60 rows, probably.

    And yes, I could do it by manually coloring the cells - I did that last year. I'm just curious about whether an automated coloring solution is feasible.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,174

    Re: Conditional formatting range changes when cells are merged

    Yes ... it possible to check the values in cell (or range of) and then colour the cell accordingly and add a border.

  7. #7
    Registered User
    Join Date
    10-20-2016
    Location
    California
    MS-Off Ver
    Excel 2013/2016 (work/home)
    Posts
    1

    Re: Conditional formatting range changes when cells are merged

    Quote Originally Posted by JohnTopley View Post
    lesson here is simple: Do not use merged cells as they cause too many problems
    Thank you for this! I've had a problem with merged cells using conditional formatting for a week, and this fixed it! I never expected merged cells to cause additional issues.

+ 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. [SOLVED] Malfunction of conditional formatting in merged cells
    By Agnese in forum Excel General
    Replies: 11
    Last Post: 02-17-2023, 07:00 AM
  2. Replies: 6
    Last Post: 10-29-2015, 03:38 PM
  3. Extending conditional formatting in combination met merged cells
    By jackhays in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-10-2015, 09:24 AM
  4. Conditional formatting in merged cells
    By davehow87 in forum Excel General
    Replies: 1
    Last Post: 08-11-2014, 04:56 AM
  5. [SOLVED] Find all merged cells via conditional formatting?
    By se15 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-14-2013, 03:57 PM
  6. Conditional Formatting of Merged Cells
    By ClubCrackerz in forum Excel General
    Replies: 0
    Last Post: 06-14-2012, 03:58 PM
  7. Move merged cells with conditional formatting?
    By SpikeUK in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-08-2005, 01:04 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