+ Reply to Thread
Results 1 to 7 of 7

Thread: Data VAlidation - Text Length & Character Type

  1. #1
    Forum Contributor
    Join Date
    06-24-2006
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    100

    Data VAlidation - Text Length & Character Type

    Dear all

    Is it possible to use solely data validation using a custom formula to restrict the length of the text in a cell AND also at the same time the type of characters entered eg no $ or % ?

    Thanks.

    Jim

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Data VAlidation - Text Length & Character Type

    Hi Jim,

    Try this as a custom validation for cell A1.
    =(LEN(A1) < 10) * ISERROR(FIND("$",A1))  * ISERROR(FIND("%",A1))
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    06-24-2006
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Data VAlidation - Text Length & Character Type

    That is brilliant!

    CAn you explain the syntax behind it? I find data validation custom formulas different from ones that in a normal cell and hard to get my head around - why are they different?

    If I had a large list of characters I want to exclude I guess I would duplicate the IsError Find sections?

  4. #4
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Data VAlidation - Text Length & Character Type

    Hi Jim

    I tackle these problems one at a time, one cell at a time.
    I looked down the Validation List and saw Custom and decided it must be a custom rule.

    I started with cell A1 and put Len(A1) < 10 and Excel didn't like it. I put a = in front of it and it worked. Trial and Error, Got Lucky.
    So Validation is looking for a equal in front (like Conditional Formatting) that it can check for True or False to accept.

    Then in another Cell I tried Find("$",A1) and it came back #Value. Bummer. So I put a =IsError in front of it and it became TRUE. I did the same for % and just built up the formula using ANDs. That didn't work so I remembered somewhere the Times means AND and Plus means OR. I changed the AND to "*" and got lucky.

    So the final answer is it only returns True if it is (True * True * True). I think its more of watching the brilliant gurus on this board that gives me a step up.
    Last edited by MarvinP; 02-25-2011 at 10:23 PM.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: Data VAlidation - Text Length & Character Type

    Very Good Explanation Marvin,,

    Its more of a Experienc-It with Several tries.. Approach...!!!

    Deduced to a solution..!

    Simply Great!

    Warm Regards
    e4excel

  6. #6
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Data VAlidation - Text Length & Character Type

    I used to teach high school math. In the section of "Word Problems" I preached you must guess an answer and build formulas by discovering what didn't work. As soon as you have something that doesn't work, you are closer to an answer. Finally after some wrong guesses and a little frustration you arrive at a formula. With the formula you could then solve it to find the final answer.

    See http://en.wikipedia.org/wiki/How_to_Solve_It

    There was this HUGE problem for many students, even for good students, as they didn't want to guess a wrong answer. They just wanted the formula where they plugged in the variables, turned the crank and out poped (or pooped) the answer. I found that there was this attribute for people called Gumption or Fortitude or Confidence that allowed them to accept a wrong answer to get closer to the final answer.

    I hope this post showed how to guess wrongly and keep going with smaller parts of the puzzle to arrive at a formula. I've been watching DonkeyOte (i'm not worthy) build some unbelieveable CSE formulas. I'm sure he builds them a small peice at a time with trial and error. I'll get there someday.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  7. #7
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: Data VAlidation - Text Length & Character Type

    Totally agree marvinP,

    The Gurus like DaddyLonglegs and DonkeyOtes, SHG,RoY,NBVC, and several others are just legends and have just left a great legacy..

    Need to have an indomitable spirit to face failure to come out as Winner!

    Warm Regards
    e4excel

+ 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.2.0