+ Reply to Thread
Results 1 to 3 of 3

If Cell is like

Hybrid View

  1. #1
    Registered User
    Join Date
    10-18-2010
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    73

    If Cell is like

    Is it possible to write a formula that identifies cell data in the format of a social security number? Something like this.

    =if(A1 like "???-??-????", A1, B1)

    The goal is to tell Excel to return A1 if A1 is formatted like a social security number. Otherwise, return B1.

    Thanks,
    Steve

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If Cell is like

    Hi,

    =IF(AND(LEN(A1=11),SUMPRODUCT(--(ISNUMBER(--MID(A1,{1,5,8},{3,2,4}))))+SUMPRODUCT(--(MID(A1,{4,7},1)="-"))=5),A1,B1)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,732

    Re: If Cell is like

    Here is a short tutorial on how to create an if statement based upon the format of a cell. Regretfully, Excel does not appear to have a format code for the special format Social Security Numbers.

    http://office.microsoft.com/en-us/ex...010062392.aspx
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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] When one cell equals value of another cell, then third cell displays text of fourth cell?
    By spookymyo in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-12-2021, 02:12 PM
  2. Replies: 7
    Last Post: 02-05-2014, 02:20 AM
  3. copy a cell multiple times depending on cell value starting on a specific cell
    By weritadiojomiel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2013, 05:25 AM
  4. Replies: 1
    Last Post: 11-03-2012, 09:05 PM
  5. Change Cell Font Color if Cell Contains Formula Referencing Another Cell
    By wilcox.patrick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2012, 10:24 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