Consulting

Results 1 to 8 of 8

Thread: Compare + Conditional Formatting Help

  1. #1

    Question Compare + Conditional Formatting Help

    Hey, everyone I am having difficulty with something that I'm sure is simple enough to put together. Politely asking for some assistance or direction.

    I am using Excel 2010.

    I have 2 sheets set up as follows:

    -Vendors in Column A.
    -Months of the Year in Row 2. (this will be ongoing, likely spanning many years)
    -Currency Values are in the table. (some vendor salaries are paid multiple months)

    What I would like to do:

    The vendor lists from both sheets are of different length. Sheet 1 has expenses. Sheet 2 has the estimated budget.

    I assume the macro would have to do this all in one step:

    Part 1:

    I need to compare cell values based on:
    Compare the two vendors columns (Sheet 2 Vendors list is smaller). Find matches. Scan the row and find the cell that has the same column month. Compare the cells.

    Part 2:

    I would need some conditional formatting based on the comparisons.
    Something like this:
    -If the values are the same. = Green.
    -If one is greater than the other = Red.
    -If one is less than the other = Blue.

    I would greatly appreciate any help anyone could provide. I have attached a sheet with an example. I tried to fill it out the best I could. Please see Sheet1 (the lookup sheet) Sheet2 = the sheet that needs the markup and highlighting.
    Attached Files Attached Files

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I would change the month headings to real dates with a formula of =DATE(2012,COLUMN()-COLUMN($A$1),1) copied across, on both Expenses and Budget and format the cells as mmm.

    Then the CF formulae are:
    Red: =AND(B4="",INDEX(Expense!$A$1:$Y$21,MATCH($A4,Expense!$A:$A,0),MATCH(B$2,Ex pense!$2:$2,0))>0)
    Green: =INDEX(Expense!$A$1:$Y$21,MATCH($A4,Expense!$A:$A,0),MATCH(B$2,Expense!$2:$ 2,0))<B4
    Yellow: =INDEX(Expense!$A$1:$Y$21,MATCH($A4,Expense!$A:$A,0),MATCH(B$2,Expense!$2:$ 2,0))>B4
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Would this be dynamic? If I continuously added values, this would carry on?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Add values where?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Quote Originally Posted by xld View Post
    Add values where?
    If I added more vendors, and then inputted costs into the sheets. There will be many more numbers populating the tables than the example I have outlined.

    Is it possible for you to upload the file with your implementation? I understand what is doing on, but I'm getting a worksheet referencing error?

    Also many thanks for your very quick reply!
    Last edited by omniscience; 11-19-2013 at 09:28 AM.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If the tables are likely to grow, it would be best to build some dynamic named ranges and use them in the formulae.

    I will build an example and upload it later tonight/tomorrow.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Thank you kindly! I would greatly appreciate it if you could. I am curious as well. Would there be any advantage generating this all automatically within VBA?

  8. #8
    Quote Originally Posted by xld View Post
    If the tables are likely to grow, it would be best to build some dynamic named ranges and use them in the formulae.

    I will build an example and upload it later tonight/tomorrow.
    Hey xld,

    Were you able come up with an example? I would really appreciate taking a look at your iteration.

Posting Permissions

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