+ Reply to Thread
Results 1 to 19 of 19

conditional Formatting based on existing formatting

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    conditional Formatting based on existing formatting

    Okay, I can't believe I can't find this on the internet, when it seems it should be so easy. Here's my problem, and how I want to solve it (other solutions would be welcomed as well).

    In my Worksheet I have approximately 12000 lines that originally came from a pivot table. In the pivot table all of my "Total" lines were colored blue.

    The pivot was pasted to another worksheet as Values and as Formats, so I still have Blue on my total lines.

    Now I'm adding multiple calculated columns, and I want the lines that match up with the total lines to be blue as well. How do I do it?

    Also, I'd like the blue lines to automaticaly fill in with the values from the last subtotal. Is there a way to automate that also through conditional formatting?

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    No replies yet, and still in need of a solution. Any ideas out there?

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Okay, I'm starting to feel disillusioned. Does the question need to be rephrased?

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Okay, not getting even a nibble, so I'll close this thread. But I WILL resurrect it at some point, so keep thinking about it.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    You can apply conditional formatting to colour rows based on word Total being contained in a particular cell of that row...

    So, for example, you want to highlight Total rows in new columns D:F

    Select the range of cells from D to F and invoke conditional formatting from the Format menu.

    Then select Formula Is and enter formula:

    =Search("Total",$A1)

    where $A1 matches top row selected to format and represents column where the Total word is contained.

    Then click Format and choose the matching colour.

    The second part can't be done with conditional formatting, it would probably need formulas.. but you need to give more detail about the source data and what you need back.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    NBVC,

    Thanks so much for responding. I've attached a very small sample so you can see what I'me talking about (sorry if I didn't express myself very well). The paste from the Pivot is in black ink. A representative additional column is in red ink. My comments (what I need) are in green.

    The real workbook has about 20 additional calculated columns. They're populated through calculations and VLookups, so I have to input the formulas then populate them down to the bottom of the data. Plus, the original pivot has up to 12K lines, which is why I don't like to do this all manually.

    any help is muchly appreciated.

    Thanks,
    John
    Attached Files Attached Files
    Last edited by NBVC; 02-15-2011 at 05:18 PM. Reason: correct spelling of NBVC

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    Try this formula in J3:

    Please Login or Register  to view this content.
    confirmed with CTRL+SHIFT+ENTER and copied down.

    Then select J3:J144 and apply conditional format formula:

    =AND(ISERR(SEARCH("Grand Total",$B3)),SEARCH("Total",$B3))

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Close, but not quite there.

    Following your instructions, the cells in column J change color correctly, but the rest of the line from A to I doesn't change. How do we do it?

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Never mind my last comment; I was working on the opposite problem today. Your solution works EXACTLY as requested. Thank you so much.

    Now, with that said, if someone pasted a pivot and DIDN'T color the Total lines, how would I go about coloring all of them from A to Last column?

  10. #10
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: conditional Formatting based on existing formatting

    When applying the conditional formatting, first select A3:I144
    Does that work?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    Quote Originally Posted by jomili View Post
    Never mind my last comment; I was working on the opposite problem today. Your solution works EXACTLY as requested. Thank you so much.

    Now, with that said, if someone pasted a pivot and DIDN'T color the Total lines, how would I go about coloring all of them from A to Last column?
    You are wanting to format the Pivot table itself?

  12. #12
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Chemist,
    Yes, that works very well. Thanks.

    NBVC,
    No, not the pivot itself, I know how to do that. But frequently I get the remnants of pivot table (values and formats), including all the "Total" lines, and want to color them. I thought I could use your formula/conditional format combination to do it.

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    This formula applied to your conditional formatting will highlight rows that contain "Total" in cell A1 or column A if you selected a range, as ChemistB mentioned and applied it


    =Search("Total",$A1)

    Note that if you select a range starting at a different row, then change the 1 in $A1 to match the top most row you selected.

  14. #14
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Thanks NBVC,

    If you don't mind, would you help me to understand this formula? I tried it on another sheet, and thought I changed all the references correctly, and couldn't get it to work.
    Please Login or Register  to view this content.

  15. #15
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    I think the formula should be:

    Please Login or Register  to view this content.
    I am not sure what I did on that first attempt.. of I didn't notice a glitch...

    The formula starts by looking to see IF(B3="Grand Total"

    if it does then it sums according to SUMIF(B$2:B2,"*Total",J$2:J2) which means sum all values in column J from the first row to the row above the current row where column B ends with the word "Total".

    If it doesn't, then it goes to next step IF(ISNUMBER(SEARCH("total",B3)) and looks to see if the column B cell in current row contains "total"... if it does then SUM(INDEX($J$2:J2,MATCH(2,1/(B$2:B2<>""))):J2). This part sums all values in column J from row where the last non-blank cell occurs in column J above current row to the cell in column J above current row. This part MATCH(2,1/(B$2:B2<>"")) finds the last non blank row in column B from B2 to row above current row....

    If column B doesn't contain "total", then it goes to this part: LEN(SUBSTITUTE(D3," ","")) which was your original formula to calculate number of characters in the string with no spaces....

    I hope that helps and apologize if the original formula confused you...

  16. #16
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    NBVC,

    There is absolutely no reason to apologize; you've helped me tremendously, both with the formulas in with explaining them. Most formulas I can figure out to adapt them to changing circumstances, but that one you created was a humdinger. I started trying to break it down by parts, and I'm still very confused on using the INDEX and MATCH functions (I've seen them used, and read a bit about them, but still can't figure out how to use them), and I know nothing about the Substitute function, but I guess I'll have to look that up.

    Thanks for the great explanation and all the help you've provided.

    Thanks,
    John

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    You're very welcome.

    I am not sure if this is one of the websites you visited on your quest to learn the Index/match combination, but here is a good one to show you some basics:

    http://www.contextures.com/xlfunctions03.html

    Contextures is a good website for you to get to know alot of functions and how they work independently and with other functions for added functionality and complexity.

    Most of these "combined" functions are learned by watching these forums, because people in these forums have done alot of trial and error playing and testing and have come up with these great working combinations... no book will have most of these formulas in them. You've got to love Excel to really be persistent and learn and try different things and understand how you can combine things to get the desired outcome. It is amazing how much you really can do with this program

    that is why my signature contains the phrase...Where there is a will there are many ways.... It really applies with this program...

    Good luck.

    Here are a couple more websites I like for learning how functions work independently and together with others:

    http://www.xl-central.com/index.html

    http://www.techonthenet.com/excel/index.php

    Both.. amazing sites, in my opinion

    There are also a couple of sticky threads in the Excel General forum that have hundreds of useful links...
    Last edited by NBVC; 02-18-2011 at 10:01 AM.

  18. #18
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Re: conditional Formatting based on existing formatting

    Thanks NBVC,

    I am familiar with the Contextures websites; I'm reading on it every chance I get, but my chances are only at work, and I usually have a specific task I'm trying to solve, so don't gain all the wisdom I can.

    I ask a lot of questions on the forums, and try my best to understand the solutions presented, and probably irritate some folks when I don't understand or ask for an explanation. But I'm understanding a lot more than I once did, and I'm beginning to be convinced that Excel can do just about anything. Thanks for showing me more of the possibilities.

  19. #19
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional Formatting based on existing formatting

    We are here to help... and if asked, most of us endeavour to give an explanation, because we appreciate that some people want to learn and not just be spoon fed. We were all there once too... and believe it or not, we are all still learning something new everyday on this forum (don't let the Moderator/Guru/MVP status fool you into thinking we know everything there is to know about Excel)...

+ 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