+ Reply to Thread
Results 1 to 8 of 8

automatically format cell based on another cell's format

  1. #1
    Registered User
    Join Date
    04-18-2008
    Posts
    4

    automatically format cell based on another cell's format

    Hopefully, someone can help me with this. I'm not even sure what to call it, so I'm having a hard time searching the questions already asked. I'm using Excel 2003.

    I have a workbook with a large spreadsheet, and several smaller "summary" spreadsheets that do nothing that reference the larger one. In other words, all of the information to populate the cells goes in the first spreadsheet. The next 3 spreadsheets all refer back to it so that we can print out summary tables based only on certain topics.

    Do do this, I essentially have the following formula in each cell of the summary spreadsheets: ='Master Table'!C6

    Actually, since I don't want a "0" if the cell is blank, I used =IF(('Master Table'!C6=""),"",('Master Table'!C6))

    Anyway, any changes to the data MUST be put in the master table. To help keep track of things, I often highlight cells (e.g. yellow = update this cell)

    Is there a way to get the summary table to automatically highlight the cell I highlighted in the master table? Like some sort of conditional formatting that reads "format of this cell = format of that cell"?

    Anything I do would need to be within the pointing and clicking or formula realm of Excel - I do not know how to do any Excel programming.

    Thanks,
    Laura

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning nativeplanter

    ...and welcome to the forum!!

    You could do this, but there are a couple of things :
    1. You will need to use code (VBA) to write a function that will recognise the colour of other cells
    or
    2. You need to download and install my add-in from the link below which has a utility that will insert this code for you.

    You'll also need to let us know what conditions you need your cells to react to - we can use the conditional format to do that, but remember that with Excel 2003 you can only set up 3 conditions.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    04-18-2008
    Posts
    4
    Thanks for the welcome, Dominic.

    It sounds like I may be out of luck unless I learn VBA. Since I'm using company computer, I can't install your add-in. Also, the issue isn't really conditional formatting (I think, anyway). Basically, I'm just looking for a cell to report exactly what is in a different cell, including any formatting (which can change from time to time as the user updates the spreadsheet). I know I can get the content of the referenced cell by using the formula "= A6", but I'd like to get its format, too. Essentially, what I want is that if someone has highlighted A6, or made it bold, so that it stands out, this automatically is put into the new cell as well. In layman's terms, I want to write a formula that says "= A6 and = whatever formatting A6 has".

    Not sure I'm making any sense here, or as I said, if this is even possible without using code.

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi nativeplanter

    A formula (user defined function, or otherwise) can't be used to change the format (bold, colour etc) of any cell. You can use a custom function to report the colour of a cell or report if a cell has bold formatting applied, but it can't change the format.

    It sounds like Excel can't do what you require, but if you want some help putting together some custom functions to return a colour, or if a cell is bold then I can help out on that and tell you exactly where they need placing - it sounds trickier than it actually is .

    HTH

    DominicB

  5. #5
    Registered User
    Join Date
    04-18-2008
    Posts
    4
    Ah, yes, you are right. I meant to say "function" above, not formula.

    I'd love to know how to have a function report on the color or boldness of a cell. That would be a start in the right direction, and it might make sense to use conditional formatting afterwards to make the target cell the same color.

    Thanks for helping me with this,
    Laura

  6. #6
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi nativeplanter

    OK. Open just your workbook in Excel and press Alt + F11. This will open the VBE (Visual Basic Environment), which is where you can enter / edit your code (macros). Go to Insert > Module and in the empty pane that opens up, copy the code from below :
    Please Login or Register  to view this content.
    You can now go to File > Close and Return to Microsoft Excel.

    This contains two custom functions : =CellColour() and =IsBold() . CellColour will return the ColorIndex number of the colour, IsBold will return a boolean (True / False) value.

    I was going to give instructions on its use now, but I think an example workbook would serve better, so have a look at the attached.

    One more thing : nothing to do with me (it's a Microsoft thing), but the formulae will only update on the next recalc - a recalc isn't performed when you change formatting. To force a recalc, just press F9.

    HTH

    DominicB
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-18-2008
    Posts
    4
    OK, I think I get it. I'll let you know how it goes!

    Thank you so much for showing me how to do this. Especially for showing it step by step. I really appreciate it.

    Laura

  8. #8
    Registered User
    Join Date
    04-11-2012
    Location
    Dayton, oHIo
    MS-Off Ver
    Excel 2007/2010
    Posts
    1

    Re: automatically format cell based on another cell's format

    Hello,

    The formula listed on this thread seems to apply to the color manually assigned to the cell, and not the color applied by conditional formatting. I tried out your code and like what it does, however it still misses what I'm trying to achieve. I have a spreadsheet used to help someone else keep track of bills. I have conditional formatting setup to make cells highlight yellow when the due date is entered and change to green once the payment amount has been entered. That's step 1 of my formatting needs.

    Step 2, if possible, would involve highlighting the cell with the name of the payee to a specific color if ANY cells in the following columns within the same row are highlighted yellow. So for example:

    If ANY cell in the range of C1:H1 are yellow, then cell A1 will change to yellow with a conditional formatting formula similar to "=CellColour(C1:H1)=36".

    Is such a task possible?

    NOTE: The green format of the existing conditional format does not need to be factored into the second. I'm just looking on applying a conditional format if the referenced cell(s) is yellow as a result of the first conditional format. Also, I learned by using your CellColour function that the shade of yellow I prefer using =36.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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