+ Reply to Thread
Results 1 to 6 of 6

Data validation text length based on value in another cell

  1. #1
    Registered User
    Join Date
    12-24-2020
    Location
    Nampa, ID
    MS-Off Ver
    2010
    Posts
    10

    Question Data validation text length based on value in another cell

    Hello,
    I'm trying to set up one cell to be required to be 12 digits long if the cell to the left is equal to "S". How do I accomplish this using data validation. I tried this formula and thought it was working but it it was restricting the value in E7 no matter what value was in D7: =IF(D7="S", LEN(E7)=12). The point is to disallow incorrect ticket numbers in column E when column D designates "S" as the hauler. Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data validation text length based on value in another cell

    Like many will point out, a sample file is best. See the yellow banner above.


    But if I am reading this right... you just need a handler for the FALSE as in When it does NOT equal S...

    Now, I am just making it be anything at this point... but something like this should step you through to the next option
    =IF(D7="S", LEN(E7)=12,LEN(E7)>0)
    -If you think you are done, Start over - ELeGault

  3. #3
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data validation text length based on value in another cell

    To take it a step further... I dont know what you are doing with your data... but I would setup a table of constraints as I assume there is more than just an S class ticket?

    Setup a table... lets call it Ticket_Constraints but you can call it what you wish.
    Column 1 Being TicketType
    Column 2 Being Length

    From here we can setup a valid/invalid check in a cell next to the entry location. You said you are on E7 so lets say you enter it in on F7...
    What we will do now is make it lookup the Length based on the Ticket Type you enter into D7.

    F7
    Please Login or Register  to view this content.
    You could change the 2 Reference to another Match in which you determine which column has Length, but if there are no other values a 2 will suffice

    Now the Data Validation can look at F7 but validation is applied to E7
    Data Validation is
    Please Login or Register  to view this content.
    Really hard to give good direction without knowing the file... but if it was me I would have a visual flag for the user along with a Data Validation to hard stop. Doing lookups in validation lists is a no no so embedding it in the sheet is a good move. If this is the ONLY place you enter the ticket number/ID then you can hide that valid/invalid and make it a 1/0, True/False...etc. to validate against... all optional but really comes down to you and your design!

  4. #4
    Registered User
    Join Date
    12-24-2020
    Location
    Nampa, ID
    MS-Off Ver
    2010
    Posts
    10

    Re: Data validation text length based on value in another cell

    I apologize for the lack of an example sheet but yes, that is exactly what I needed and it works perfectly now. Thank you very much for the help!

  5. #5
    Registered User
    Join Date
    12-24-2020
    Location
    Nampa, ID
    MS-Off Ver
    2010
    Posts
    10

    Re: Data validation text length based on value in another cell

    I appreciate the time you took to do all that but EleGault solved my issue by just added the last bit onto my formula that I had started. Thanks again

  6. #6
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data validation text length based on value in another cell

    Heh, was me in both posts

    Glad that was good enough for what you needed!
    Be sure to mark the thread solved under the thread tools up there

+ 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] Data Validation based on value of another cell + length of input
    By tiger99 in forum Excel General
    Replies: 4
    Last Post: 11-20-2019, 12:16 AM
  2. Limiting Text Length, Without a Data Validation
    By Moho280 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-24-2014, 10:23 AM
  3. Replies: 7
    Last Post: 01-25-2014, 07:53 AM
  4. [SOLVED] Data validation based on another cell containing specific text
    By Sph01 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-06-2013, 05:51 AM
  5. [SOLVED] Data Validation format length based on values in another cell
    By rini11 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-16-2013, 11:18 AM
  6. Data VAlidation - Text Length & Character Type
    By Jim28 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-09-2013, 04:16 AM
  7. [SOLVED] Text Length Data Validation, without error message.
    By mark in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-18-2006, 10:25 PM

Tags for this Thread

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