Consulting

Results 1 to 20 of 20

Thread: Highlight if less then subtotal

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Highlight if less then subtotal

    I am using subtotals on a spreadsheet and then I want to hightlight everything in that columnd that is less then the subtotal below it. Then after the subtotal again highlight everything that is less then that subtotal. How can I do this? I have some clues but I don't know where to begin!!!

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I want to hightlight everything in that columnd that is less than the subtotal
    wouldn't that be everything?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    no because it is a Average of the percentage above it subtotal. I actually do the other subtotals as sum and then I use code to find the where to put the averages of the percentages and I do that formula then.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    so the numbers above the subtotal are not the figures being subtotaled?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    no the subtotal is actually an average of the numbers above it.

  6. #6
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Why not just use a Pivot Table?

  7. #7
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    so it's not a subtotal....
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  8. #8
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    sorry,

    the reason why I am saying subtotal is the rest of the line is subtotals and I forgot I did them another way and also so you understand that there are multiple lines of it after each section.

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Assuming that the labels are in column A, and the amounts oin column B, use conditional formatting on A2:A20 (or adjust to the real range) with a formula of

    =$B2<INDEX($B2:$B$20,MIN(IF(ISNUMBER(FIND("Average",$A2:$A$20)),ROW($A2:$A$ 20)))-MIN(ROW($B2:$B$20)+1))

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Sorry, small faux-pas on the formula

    =$B2<INDEX($B2:$B$20,MIN(IF(ISNUMBER(FIND("Average",$A2:$A$20)),ROW($A2:$A$ 20)-MIN(ROW($B2:$B$20))+1)))

  11. #11
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Yes, I know how to do it in a formula lucas but I want to do it in code

  12. #12
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I think poor Daniel is getting spread too thin....
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  13. #13
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You're right Bob!

    He is running 5 different question at the moment.

  14. #14
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Djblois
    Yes, I know how to do it in a formula lucas but I want to do it in code
    Why? That is a class solution that I have given you, so why use code unnecessarily?

  15. #15
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Quote Originally Posted by xld
    You're right Bob!

    He is running 5 different question at the moment.
    Finally, a little humor in the mist of chaos
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  16. #16
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    lol, thanks for the concern. I am trying to get my add-in as useful as possible for my users and make it as versatile as possible (not only for reports but for easier and quicker ways to do more advanced excel features for the layman)

    Also, to the question of why would I do it in VBA, well because I am putting it in my add-in for a report that would be run weekly by my bosses secretary.

  17. #17
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Then I would create a template report, with all the formatting including CF, and open that from the add-in, and populate as required.

  18. #18
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    The problem with that is the data prints out of our proprietary software right to an excel spreadsheet. Also, the subtotals will not always be in the same spot the might be higher and sometimes lower.

  19. #19
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    My solution works out where the subtotals are, it is not dependent.

    The other thing looks like a sticky though, although you could still use a template and just copy the data (is this where you want to remove rows and columns as well?) values wholesale onto the template.

  20. #20
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    no that is a seperate function, just for user created tables. that is why I didn't put them in the same thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •