+ Reply to Thread
Results 1 to 10 of 10

Data validation function rules

  1. #1
    Registered User
    Join Date
    07-01-2015
    Location
    Antwerp
    MS-Off Ver
    2019
    Posts
    71

    Data validation function rules

    Hi, I'm looking for a function within data validation:

    I have cell A and cell C. The values of cells A and C must be integers that cannot be lower than 0 and not be higher than 5. You get a data validation error message if the cell entry does not comply with this rule.
    But in the same data validation there should be a rule that when cell A has a value of 5, cell C must have a value from 0 to 4. And this vice versa (i.e. when cell C has a value of 5, the value of cell A must be from 0 to 4).
    If this is not the case, you get a data validation error message.

    Thanks!

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Data validation function rules

    Try:

    =AND(MOD(A1,1)=0,MOD(C1,1)=0,A1+C1<10,MIN(A1,C1)>=0,MAX(A1,C1)<=5)

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Data validation function rules

    See attached ...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-01-2015
    Location
    Antwerp
    MS-Off Ver
    2019
    Posts
    71

    Re: Data validation function rules

    Very nice, Phuocam. However, I forgot to mention that, additional to these rules, one of both cells should always have a value of 5.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Data validation function rules

    Edit:

    =AND(MOD(A1,1)=0,MOD(C1,1)=0,A1+C1<10,MIN(A1,C1)>=0,MAX(A1,C1)=5)

  6. #6
    Registered User
    Join Date
    07-01-2015
    Location
    Antwerp
    MS-Off Ver
    2019
    Posts
    71

    Re: Data validation function rules

    Thanks, Phuocam. This formula is correct but it gives a problem. When for example cell A has a value of 4 and cell C a value of 5, but you want to change the value of cell A to 5 (and then the value of cell C to 4), you get the error message ... Can this be solved so you can change it without getting the error message?

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Data validation function rules

    Remove content A and C before the change

  8. #8
    Registered User
    Join Date
    07-01-2015
    Location
    Antwerp
    MS-Off Ver
    2019
    Posts
    71

    Re: Data validation function rules

    Is there another way to do this? So you can overwrite the values without the error message popping up? The process of quickly altering large data sets gets slowed down significantly with this extra step.

  9. #9
    Registered User
    Join Date
    07-01-2015
    Location
    Antwerp
    MS-Off Ver
    2019
    Posts
    71

    Re: Data validation function rules

    I have a question. If cell C is empty and you want to enter a value in cell A, it allows you to enter a value higher than 5, which is actually against the data validation rule (max value is 5). The ignore empty cells box is checked.
    In the same situation, if I uncheck the ignore empty cells box, you cannot enter a value higher than 5 but not lower than 5 either, only 5 itself.

    How could this issue be overcome by adapting the data validation formula so that an entry in cell A can range from MIN 0 to MAX 5 when cell C is empty?

  10. #10
    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,938

    Re: Data validation function rules

    Retroshift Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    https://www.mrexcel.com/forum/excel-...ula-rules.html
    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

+ 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] Macro to protect data Validation rules
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-10-2020, 08:05 AM
  2. [SOLVED] Data validation with multiple rules
    By Rockguts in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-08-2016, 08:47 AM
  3. [SOLVED] IF AND / OR Statement for Data Validation rules
    By DPaton in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-30-2014, 12:53 AM
  4. Seeing which cells have Data Validation rules
    By marketshare in forum Excel General
    Replies: 5
    Last Post: 03-27-2011, 07:51 PM
  5. validation rules not working when someone copy paste data on validation cell
    By jthakrar in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-17-2010, 03:36 AM
  6. Replies: 2
    Last Post: 01-03-2010, 05:21 PM
  7. [SOLVED] Data Validation Rules
    By Louise in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-10-2006, 08:10 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