+ Reply to Thread
Results 1 to 8 of 8

Data Validation multiple restrictions in one cell

  1. #1
    Registered User
    Join Date
    10-29-2014
    Location
    Wales
    MS-Off Ver
    Excel 2013
    Posts
    17

    Data Validation multiple restrictions in one cell

    Hello, following help from this forum I managed to put a restriction in my spreadsheet only allowing data to be put in a cell (E9) if another cell (B9) has been completed first, using the validation criteria

    Allow: Custom
    Formula: =B9<>0
    with an Error Alert: B9 must be completed first, click Cancel

    This has worked to date, however, due to a further restriction I now need to only allow data to be put in cell (E9) if BOTH (B9) and (C9) have been completed first.

    Also, is there a way for the Error Alert to specify which cell has been left blank or, if both are blank to specify both cells? If not I can always just use an Error Alert saying that either B9 and/or C9 have been left blank and must be completed first, but lets try for the gold

    Can you help please?

    Thank you

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Data Validation multiple restrictions in one cell

    Try
    =AND(B9<>0 ,C9<>0)

    Cannot identify which cell fails in error message but you could put formula below in adjacent cell
    =IF(B9=0,"B9 needs you",IF(C9=0,"C9 needs you",""))
    Last edited by kev_; 03-21-2018 at 08:53 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Data Validation multiple restrictions in one cell

    Replace the formula with this:
    =AND(B9<>0,C9<>0)
    Make sure 'Ignore blank' is not ticked.

    I don't know of any way to have the Error Alert change depending on which cell(s) are not filled in, sorry. It may be possible with VBA, but that's not my strong point.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  4. #4
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Data Validation multiple restrictions in one cell

    Okay, I've had a bit of a play and come up with a bit of a cheat to display which cell(s) are blank.

    1. Insert a new column to the left of column E (in other words, a new column E so that your E9 becomes F9).
    2. In the new E9, type this formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    3. Set the width of the new column E as 0.08 (that's the smallest non-zero width Excel will accept).
    4. Adjust the width of column F (the old column E) so it's wide enough to show the whole error message if necessary.

    If you want to be able to drag this down, you'll need to replace the hard-coded B9 and C9 with generated cell addresses. You can do this with CELL, like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The attached file shows the above working.

    Hope that helps.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Data Validation multiple restrictions in one cell

    Another alternative would be to use conditional formatting on cell E9

    User should only try to input if cell contains no colour
    - image below is DataValidation error message which explains the colour

    DV with CF.jpg

    In any case the cells are very close to E9 - the user could simply look at both cells after seeing your warning!
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-29-2014
    Location
    Wales
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: Data Validation multiple restrictions in one cell

    Thank you, your solution is exactly what I needed my spreadsheet now works as required. I decided to keep the error message simple, but thank you for your suggestions.

    This forum never fails to provide the right solutions - my first go to for queries.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Data Validation multiple restrictions in one cell

    Please click ThreadTools@TopOfThread to mark it SOLVED









    You can thank anyone who helped you by clicking on *AddReputation on their post

  8. #8
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Data Validation multiple restrictions in one cell

    Glad we could help and thanks for the rep.

    If that takes care of your original question, then please take a moment to mark the thread as Solved so others know there's an answer here (instructions are in my sig and in kev's message above). Thanks.

+ 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. Multiple Data Validation and Restrictions
    By SuperCoog in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-27-2017, 12:01 PM
  2. [SOLVED] Character limits, validation, characters restrictions
    By martin81 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-27-2016, 03:45 PM
  3. Multiple Data Validation in one cell
    By dannyjok1990 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-02-2016, 01:06 PM
  4. Validation of Answers and laying access restrictions
    By Pavan.Sada.PS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2014, 02:54 AM
  5. Data Validation / Restrictions
    By naiku in forum Excel General
    Replies: 2
    Last Post: 08-11-2014, 04:20 PM
  6. Multiple Data Validation in one cell
    By willmark in forum Excel General
    Replies: 3
    Last Post: 12-07-2012, 04:14 PM
  7. Data validation restrictions
    By Kimberley in forum Excel General
    Replies: 3
    Last Post: 11-25-2011, 10:59 AM

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