+ Reply to Thread
Results 1 to 18 of 18

Data Validation to Highlight Cells

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Data Validation to Highlight Cells

    I have a number of cells in each row of a sheet where the user will enter percentages. I need to find a way to highlight all the cells in that row (columns A, C, E, G, I) if the total of all the cells <> 100%. Ideally I only want the cells highlighted after the last entry has been made, so if the user enters 20% in A2, 20% in C2, 20% in E2, 20% in G2, and 10% in I2, then all these cells should be highlighted to show that the total of these cells doesn't = 100%. I don't want the data validation to kick in until all the cells have entries. The user will be asked to enter 0% if there is no percentage, so will be asked to complete all cells.

    This needs to work for each row in the sheet.

    Many thanks

  2. #2
    Valued Forum Contributor
    Join Date
    09-15-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    436

    Re: Data Validation to Highlight Cells

    Please try this logic.
    Attached Files Attached Files
    Please click 'Add reputation', if my answer helped you.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Data Validation to Highlight Cells

    Hi

    Does something like this could works for you?

    In CF rules.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Data Validation to Highlight Cells

    Hi Fotis1991,

    Thanks for that, I like the logic. The only problem, which is down to me not explaining it very well, is that I2 could actuall = 0%, so while the logic works, it possibly needs to be something along the lines of 'Is Not Blank and >= 0', so meeting two conditions. I've tried playing around with it but can't get it to work!

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Data Validation to Highlight Cells

    perhaps
    =AND($I2>0,$I2<>"",SUM($A2,$C2,$E2,$G2,$I2)<>100)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Data Validation to Highlight Cells

    Hi JosephP,

    That's what I thought, I tried (with my actual cell references)

    =AND($AM5<>"",$AM5>=0,SUM($M5,$O5,$Q5,$S5,$U5,$W5,$Z5,$AB5,$AD5,$AF5,$AH5,$AJ5,$AL5,$AM5)<>100)

    and

    =AND(NOT(ISBLANK($AM5)),$AM5>=0,SUM($M5,$O5,$Q5,$S5,$U5,$W5,$Z5,$AB5,$AD5,$AF5,$AH5,$AJ5,$AL5,$AM5)<>100)

    but neither work and I can't see why?

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Data Validation to Highlight Cells

    This one looks to work. Does it?

    =AND(OR($I2=0,SUM($A2,$C2,$E2,$G2,$I2)<>100),OR(COUNT($A2,$C2,$E2,$G2,$I2)=5))

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Data Validation to Highlight Cells

    did the formula work before you added the new condition? if it did I reckon your cell isn't blank

  9. #9
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Data Validation to Highlight Cells

    Hi Fotis1991,

    Everything is fine unless I2 actually does = 0, then for some reason it falls over. I tried >= for I2 because the value in I2 could be either, but when I2 does = 0 it doesn't work? So if A2=20, C2=20, E2=30, G2=30 and I2=0, that's when it doesn't work and I still can't see why! I2 can = 0.

    I tried

    =AND(OR($I2>=0,SUM($A2,$C2,$E2,$G2,$I2)<>100),OR(COUNT($A2,$C2,$E2,$G2,$I2)=5))

    but same problem!

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Data Validation to Highlight Cells

    Here is an example of what i suggested.
    Attached Files Attached Files

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Data Validation to Highlight Cells

    Quote Originally Posted by HangMan View Post
    Hi Fotis1991,

    So if A2=20, C2=20, E2=30, G2=30 and I2=0, that's when it doesn't work and I still can't see why! I2 can = 0.
    If you add these you get 100! So as one of the conditions is <>100, then correctly does not highlighted anything. Isn't this correct?

  12. #12
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Data Validation to Highlight Cells

    Hi Fotis,

    The problem is that even when they do = 100 and I2 = 0, the cells 'are' still highlighting! That's the bit I can't figure out...

  13. #13
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Data Validation to Highlight Cells

    An option is to use another rule as first, using the white color...

    =SUM($A2,$C2,$E2,$G2,$I2)=100

    This will keep all the rows that have 100 as result, whites...

  14. #14
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Data Validation to Highlight Cells

    In thoery I think this should work:

    =AND(SUM($A2,$C2,$E2,$G2,$I2)<>100,COUNT($A2,$C2,$E2,$G2,$I2)=5)

    It seems to work on your sample, I just can't get it to work (yet) on my actual sheet, so I must be doing something wrong!
    Last edited by HangMan; 09-11-2013 at 10:04 AM.

  15. #15
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Data Validation to Highlight Cells

    are you sure you have the correct row active when applying the formula?

  16. #16
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Data Validation to Highlight Cells

    Try this.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    All cells have to be filled and it doesn't matter in what order they are filled.

    In the applies to field if you want only the cells in columns A, C, E, G and I coloured enter:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In the applies to field if you want the whole row A2:I2 coloured enter this

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  17. #17
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Data Validation to Highlight Cells

    Okay, so finally figured out the problem, I'm working with percentages so it should read <> 1 and not <> 100!

    =AND(SUM($A2,$C2,$E2,$G2,$I2)<>1,COUNT($A2,$C2,$E2,$G2,$I2)=5)

    Many thanks for everyone's input, right answers, wrong implementation by me!

  18. #18
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Data Validation to Highlight Cells

    You are welcome and thanks for the feed back.

    Make sure that you will mark this thread as SOLVED. Thank you.

+ 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. Adding Date Data Validation to cells with List Data Validation
    By biggtyme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2013, 09:47 AM
  2. [SOLVED] Highlight Errors with Data Validation
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 02:15 PM
  3. [SOLVED] Highlight cells in a range that do not contain data validation (drop-down list)
    By d.sanchez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2013, 07:10 PM
  4. Data Validation would like to highlight background when invalid data is present
    By moto485 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2011, 09:20 PM
  5. Highlight data validation
    By mojobaabby in forum Excel General
    Replies: 4
    Last Post: 09-08-2010, 02:52 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