+ Reply to Thread
Results 1 to 16 of 16

Conditional format based on multiple criteria macro

  1. #1
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Conditional format based on multiple criteria macro

    Hi all,

    First post so forgive me if I am leaving out any critical information.

    I have a data set with four years of data for many different locations. I am trying to light up rows where there is a particular column that has been 0 for the most recent two years at any given location. We can call these columns FY, Location, Cost for demonstration purposes.

    I am trying to make a macro out of this because I have hundreds of spreadsheets for different data at each location that I need to apply this formatting to. Unfortunately I have had little in the way of success and would love some tips.

    Thank you,

    Scott

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    " the most recent two years" date are picked up in column "FY"
    "has been 0 " is for column "Cost"
    Is it
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    Yes that is correct. So for my example I need When Cost = 0 in both FY 2012 and 2013 to highlight all rows for that Location.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    Assuming date in column A and Cost in column D

    Please Login or Register  to view this content.
    Last edited by PCI; 05-06-2015 at 01:53 PM.

  5. #5
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    Thank you for your replies!

    This does not seem to be accomplishing what I am trying to do. Let me give a little more information (The data is sensitive otherwise I would provide a sample).

    Column A is FY, The only possible values are 2010,2011,2012,2013.

    Column F is location. There are hundreds of different locations. Each has a text string as a name. Each has data for all 4 years.

    Column T is cost.

    So for example, if location jacksonville had 0 cost for years 2012 and 2013 I would want all rows where the location = jacksonville to be highlighted.

    I hope this paints a more clear picture of my task and again, thank you for your help!

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    OK same player shot again
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    The code above is only highlighting those rows where cost = 0

    I am trying to get it to highlight all rows for one location if the most recent two years have a cost of 0.

    In the attached spreadsheet I have created a sample that shows what it would look like if done as intended.

    Highlighting rows corresponding to a location that has 0 cost the most recent two years.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    Here a remake

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    It appears that code is just highlighting the whole sheet. Any other ideas? I appreciate all of the help.

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    Here the file used.
    If it don't work with your file send it to me
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    There is no macro in that workbook you sent me..

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    Yes there is.
    Here attached the same with a short cut: Control + a
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    It seems to work in the file you sent me, but when I apply it to my data it highlights the entire sheet. I cannot figure out why.

  14. #14
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Conditional format based on multiple criteria macro

    And can you send me your file, just change the data for column A, F, T and delete all others columns cells

  15. #15
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    I cannot send the file. Even after deleting everything but those rows, it still highlights the whole sheet

  16. #16
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Conditional format based on multiple criteria macro

    Columns I mean, not rows

+ 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] Conditional format based on 2 criteria
    By galvinpaddy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-04-2015, 03:22 PM
  2. [SOLVED] Conditional format based on multiple criteria
    By Kandy1084 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-24-2014, 01:36 AM
  3. Replies: 4
    Last Post: 12-17-2011, 06:11 PM
  4. Conditional format based on 4 criteria??
    By leem in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-02-2010, 11:10 AM
  5. [SOLVED] Conditional Format based on multiple criteria
    By maw230 in forum Excel General
    Replies: 9
    Last Post: 02-16-2010, 06:24 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