+ Reply to Thread
Results 1 to 7 of 7

Formula for string of 9 characters to see if 8th character is odd or even

  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    Liverpool
    MS-Off Ver
    Excel 2013
    Posts
    76

    Formula for string of 9 characters to see if 8th character is odd or even

    Hello
    i have a problem i am building a database and i need a formula to put in colum F if the reference string which always have 9 characters(numbers and letters) if the 8th character is an odd number then allow it to be inserted into the cell if it is an even number then say this is the wrong but do not allow it to be inserted i also need same formula that works the oppsite way around allowing 8 number to be inserted if even but not odd
    I havnt got a working model of this Hope you can help thanks

    Steve

  2. #2
    Registered User
    Join Date
    06-20-2012
    Location
    PA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Formula for string of 9 characters to see if 8th character is odd or even

    Hi, if your filed in A1 cell, try this formula:
    Please Login or Register  to view this content.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Formula for string of 9 characters to see if 8th character is odd or even

    Maybe something like this.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula for string of 9 characters to see if 8th character is odd or even

    Or you could use Data Validation with this formula for the Custom option

    =AND(LEN(F2)=9,MOD(MID(F2,8,1),2)=0)

    you can then add an Input Message and an Error Alert to alert the user as to what is needed, etc

  5. #5
    Registered User
    Join Date
    05-18-2012
    Location
    Liverpool
    MS-Off Ver
    Excel 2013
    Posts
    76

    Re: Formula for string of 9 characters to see if 8th character is odd or even

    This returns true and false great now i need a formula to say if true then message box "correct if false wrong please

  6. #6
    Registered User
    Join Date
    05-18-2012
    Location
    Liverpool
    MS-Off Ver
    Excel 2013
    Posts
    76

    Re: Formula for string of 9 characters to see if 8th character is odd or even

    Cutter that is returning an error mate

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula for string of 9 characters to see if 8th character is odd or even

    Are you referring to the initial "The formula currently evaluates to an error. Do you wish to continue?" error?
    If so then click on Yes. It initially errors because it's blank.

+ 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