+ Reply to Thread
Results 1 to 6 of 6

Formattin using if function

  1. #1
    Forum Contributor
    Join Date
    09-15-2012
    Location
    las vegas
    MS-Off Ver
    excel 2007
    Posts
    147

    Formattin using if function

    I want to create a function that when a text doesn't follow a foemat, then, the result is 0.

    For example, the format is XXX-XXX. If the cell is 1234-a1, then, I should have zero.

    If the text is 123-A1A, then, I'll have 1 as the output.

    Please help. Ty

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formattin using if function

    Try this

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


    v A B
    1 1234-a1 0
    2 123-A1A 1
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formattin using if function

    Here's another one...

    =COUNTIF(A1,"???-???")
    Last edited by Tony Valko; 02-12-2016 at 10:44 AM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formattin using if function

    Quote Originally Posted by AlKey View Post
    =IF(ISERROR(SEARCH("???-???",A1)),0,1)
    That returns 1 for entries like this:

    123-123456789
    123456789-123456

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formattin using if function

    Quote Originally Posted by Tony Valko View Post
    That returns 1 for entries like this:

    123-123456789
    123456789-123456
    Your examples Tony have nothing in common with what OP is asking for.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formattin using if function

    We don't know that!

    My interpretation is that the cell must contain a sting in the format XXX-XXX and nothing else.

+ 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] Conditional Formattin withe Dates
    By ranjuv in forum Excel General
    Replies: 3
    Last Post: 07-18-2012, 07:21 AM
  2. Conditional Formattin with Percentages
    By este994 in forum Excel General
    Replies: 8
    Last Post: 05-25-2012, 11:48 AM
  3. Replies: 2
    Last Post: 10-11-2011, 08:15 AM
  4. Formattin a Report
    By bellw in forum Excel General
    Replies: 2
    Last Post: 09-13-2008, 10:17 AM
  5. Replies: 1
    Last Post: 04-01-2005, 02:06 AM
  6. Need help formattin 11x17 page!!!
    By Caligurl in forum Excel General
    Replies: 1
    Last Post: 03-26-2005, 01:23 PM
  7. [SOLVED] Text Box formattin
    By Drew Lockard in forum Excel General
    Replies: 1
    Last Post: 01-26-2005, 08:06 PM

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