+ Reply to Thread
Results 1 to 10 of 10

Will show error if you forgot to enter a data in one cell

  1. #1
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Denmark
    MS-Off Ver
    O365
    Posts
    256

    Will show error if you forgot to enter a data in one cell

    I have a table where scores need to be entered in column C, D, E, but only one score should be entered in every one row.
    Is it possible to make the cell red or any error message if (1) I entered 2 or 3 scores in each row (2) if I forgot to enter any score in one of the three cells
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Will show error if you forgot to enter a data in one cell

    This will check the values "live" when you change them: error question.xls
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Denmark
    MS-Off Ver
    O365
    Posts
    256

    Re: Will show error if you forgot to enter a data in one cell

    Quote Originally Posted by tehneXus View Post
    This will check the values "live" when you change them: Attachment 234607

    Hi,

    This is exactly what I want
    but can you please teach me how did you did this?
    because the sample I attached is just a simple table and my real database consists of hundreds of columns and rows.

    Thanks
    Last edited by Elainefish; 05-10-2013 at 12:31 AM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Will show error if you forgot to enter a data in one cell

    Im not quite sure what post #2 did, but try this instead...

    1. highlight the range you want to apply the conditional formatting to B2:D8 in your sample - adjust as needed
    2. on the home tab, styles, select CF
    1st, unless there is a reason why you are highlighting 5 red, delete that rule
    3. select new rule, select use formula
    4. enter =OR(COUNT($B2:$D2)=0,COUNT($B2:$D2)>1) format fill RED
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Denmark
    MS-Off Ver
    O365
    Posts
    256

    Re: Will show error if you forgot to enter a data in one cell

    Quote Originally Posted by FDibbins View Post
    Im not quite sure what post #2 did, but try this instead...

    1. highlight the range you want to apply the conditional formatting to B2:D8 in your sample - adjust as needed
    2. on the home tab, styles, select CF
    1st, unless there is a reason why you are highlighting 5 red, delete that rule
    3. select new rule, select use formula
    4. enter =OR(COUNT($B2:$D2)=0,COUNT($B2:$D2)>1) format fill RED


    Hi,
    I am having problems with the formula
    I attached the sheet I am working on
    I tried =OR(COUNT($AP4:$AR4)=0,COUNT($AP4:$AR4)>1)
    but seems it doesnt work
    Attached Files Attached Files
    Last edited by Elainefish; 05-10-2013 at 06:06 AM.

  6. #6
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Will show error if you forgot to enter a data in one cell

    code explained (works with any amount of rows and columns):
    Please Login or Register  to view this content.
    if you experience a long runtime of the code you should remove it from the Worksheet_Change event and assign it to a button or some other event (e.g. BeforeSave).

    Regards

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Will show error if you forgot to enter a data in one cell

    I tested your file, its working fine except that it seems to only "finish" adding red if you enter something somewhere else. I dont understand why, but I will ask some of the other experts

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

    Re: Will show error if you forgot to enter a data in one cell

    open the vb editor (alt+f11) and in the project explorer window (top left of the screen) select the Report sheet. if the properties window is not visible press f4. change the enableformatconditionscalculation property to true and save the file
    Josie

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

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Will show error if you forgot to enter a data in one cell

    Thanks JP

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

    Re: Will show error if you forgot to enter a data in one cell

    my pleasure :-)

+ 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