+ Reply to Thread
Results 1 to 7 of 7

Validation Formula

  1. #1
    Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    845

    Exclamation Validation Formula

    I need Cell A2 to only allow a number with a dash if Cell A1 has any number in it. What formula would I use for this?
    Last edited by swordswinger710; 04-21-2008 at 04:09 PM.

  2. #2
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    Maybe this will work:

    1- First format A2 as "0-" (delete the quote signs)
    2- in A2 Validation, insert the following formula in the custom section:
    =isnumber(a1)=isnumber(a2)
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  3. #3
    Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    845

    Exclamation Doesn't Work

    I can't enter anything into Cell A2 now - maybe I wasn't clear enough. Here's my situation:

    Cell A1 will not always have a number entered into it. Cell A2 will. If Cell A1 receives a number, then Cell A2 must not allow any number that doesn't include a "-" in it somewhere.

    For Example:

    A1=
    A2=12345

    A1=12345
    A2=12345-1 (Had I entered 12345 here I would have received an error message saying I need a dash since Cell A1 is filled in.)

    Is this possible?

  4. #4
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Maybe this can be modified to suit your purposes?

    Quote Originally Posted by Juda
    I can't enter anything into Cell A2 now - maybe I wasn't clear enough.
    See the logic on Sheet1
    Attached Files Attached Files
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  5. #5
    Forum Contributor swordswinger710's Avatar
    Join Date
    02-20-2008
    Location
    Bright, Canada
    MS-Off Ver
    2010
    Posts
    845

    Exclamation Hey, It Worked!

    Incredible! It took me a bit because my cells were formatted as text instead of general, but once I figured that out, it worked! Thanks a lot.

    Now since we're onto the validation subject, I have yet another question. In many of the cells where I have formulas entered, I have validated them to allow only whole numbers less than zero to prevent users from accidentally changing or deleting the formulas. This seems to work fine until someone hits delete, which allows the user to erase the formula and get away with it. I cannot use protection because then I can't merge cells, so I'm wondering if it's possible to use something else in the Validation field which won't allow anyone to change or delete the formula I worked so hard to come up with.

  6. #6
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    I may suggest...

    Quote Originally Posted by Juda
    Now since we're onto the validation subject, I have yet another question. In many of the cells where I have formulas entered, I have validated them to allow only whole numbers less than zero to prevent users from accidentally changing or deleting the formulas. This seems to work fine until someone hits delete, which allows the user to erase the formula and get away with it. I cannot use protection because then I can't merge cells, so I'm wondering if it's possible to use something else in the Validation field which won't allow anyone to change or delete the formula I worked so hard to come up with.
    I would suggest you post this as a new question on the General forum.

    My reason for making this suggestion is that I have played around and I can't find a solution to this question. Paraphrasing what one of the regulars has in his signature: There are always solutions, the problem is finding the one that works.

    Now, good posting etiquette calls for you to explain that this is a cross post, why you are posting in the new forum (new question on an old thread...??), and provide a link to this thread. Finally, when answered satisfactorily make sure both threads show the solution. This can be accomplished with a link to the thread with the solution.

    I hope that's not too confusing. If you want more explanation, send me a PM or e-mail here

    Hopefully the response at http://www.excelforum.com/showthread...34#post1911234 will resolve this.
    Last edited by DCSwearingen; 04-23-2008 at 03:03 PM.

  7. #7
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Validation Techiques

    Quote Originally Posted by Juda
    I need Cell A2 to only allow a number with a dash if Cell A1 has any number in it. What formula would I use for this?
    I recently came across this. It has a lot of different tips on validation.

    I know I saw a User Defined Function that would identify if a cell had a formula, but I can't find it right now. The context was to use it in conditional formatting, but I am sure it could also be used in Data Validation as it was a true false function.
    Attached Files Attached Files

+ 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.6.0 RC 1