+ Reply to Thread
Results 1 to 7 of 7

Validation fails even though it passes

  1. #1
    Registered User
    Join Date
    04-16-2021
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    7

    Validation fails even though it passes

    The topic sounds very confusing but it is true. I have a formula for validating cells that will return the result of "TRUE" if formula is pasted on a cell, but when entered in the validation field, it will give an error that the validation failed after you typed in the text that should pass the validation. Any idea why this could happen?

    Failvalidation.png

    Here's my sample.
    Attached Files Attached Files
    Last edited by harpbelle; 04-21-2021 at 04:51 AM.

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Validation fails even though it passes

    The explanation is that 1) you're using Office 365 which no longer requires traditional [Ctrl]+[Shift]+[Enter] array formula entry, but 2) your formula involves a term, ROW(INDIRECT("1:"&3)), which evaluates to an array. While worksheet formulas like that in Sheet1!E2 don't require traditional array formula entry, data validation formulas STILL can't handle arrays reliably. You need to keep things scalar in data validation formulas. Try

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

    There are advantages to using multiple nested IFs. If D2 isn't exactly 16 characters, why bother checking anything else? If it is, but the 1st 2 characters aren't "VB", why bother checking anything else? And so on. In contrast, using AND checks every single term because Excel's AND function isn't smart enough to use short circuit boolean evaluation.

    Some day in the distant future, Excel may FINALLY have regular expression functions as LibreOffice Calc and Google Sheets have had for years, but not just yet. Today in Google Sheets you could use =REGEXMATCH(D2,"^VB\d{6}-\d{4}[a-z]{3}$"), but the Excel developer team will have to get over NIH Syndrome for something like this to make it to Excel.

  3. #3
    Registered User
    Join Date
    04-16-2021
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Validation fails even though it passes

    Thanks. Best solution by far. I don't know why most validation formulas on the net for specific characters rely on arrays when they don't always work.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Validation fails even though it passes

    Your original validation works if you uncheck the 'Ignore blank' option in the DV settings.
    Remember what the dormouse said
    Feed your head

  5. #5
    Registered User
    Join Date
    04-16-2021
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Validation fails even though it passes

    If you save and reopen the file after unchecking Ignore blank, the validation fails again when you try to type in the cell and exit the cell.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Validation fails even though it passes

    So it does. How odd! Apologies for the mis-steer.

  7. #7
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Validation fails even though it passes

    The validation formula also works, temporarily, by appending +0 to it.

    A guess: since validation works with cell values without triggering circular recalculation, the calculation engine for validation is different than the engine for worksheet formulas. I figure it could work differently if validation formulas are defined before or after the cell contains anything, and reopening workbooks effectively resets validation evaluation context to the same state as if the cell(s) were blank.

    Whatever. Excel validation is unreliable when using arrays in data validation formulas.

+ 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. Replies: 3
    Last Post: 10-28-2013, 06:18 AM
  2. Validation list from Mac Excel 2011 fails to function on Windows 7 Excel 2010
    By lhlevasseur in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 12-17-2012, 07:08 PM
  3. Using Excel To Track Passes
    By spinster in forum Excel General
    Replies: 0
    Last Post: 08-10-2010, 01:36 AM
  4. List Data Validation Fails for Dynamic Ranges
    By mohitspamz in forum Excel General
    Replies: 2
    Last Post: 10-01-2009, 10:38 AM
  5. vlookup passes formatting
    By noahwallach in forum Excel General
    Replies: 5
    Last Post: 09-05-2009, 06:28 PM
  6. Can I return focus to a Textbox when Validation fails as part of a Sub?
    By D3Pratt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-28-2009, 06:01 PM
  7. Range.Validation Add Fails with 1004 error
    By Hila in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-15-2009, 11:11 AM
  8. Counting Number Of passes & fails by date + product
    By ajxxx in forum Excel General
    Replies: 2
    Last Post: 01-06-2009, 07:30 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