+ Reply to Thread
Results 1 to 5 of 5

Identify Cells/Data that begin with 3 characters and a -

  1. #1
    Registered User
    Join Date
    12-17-2013
    Location
    Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    10

    Identify Cells/Data that begin with 3 characters and a -

    I have a list of approx 40,000 item #'s and I need to identify anything in the list that does not begin with with a 4 character set of 3 numbers and a dash (-). Here is an example of the data

    369-8179
    369-1412
    369-6201
    J5239-40W
    140-PMT280
    361-1626
    361-1629
    361-1630WD
    361-1649R
    SP14G
    SP14O

    I would need a formula that would identify the 4th/10th/11th cells

    Thanks in advance for the help
    _EB

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Identify Cells/Data that begin with 3 characters and a -

    =IF(MID(A1,4,1)="-", "", "X") copied down
    puts an x next to every value which doens't match your pattern.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Identify Cells/Data that begin with 3 characters and a -

    Something like:

    Please Login or Register  to view this content.
    That will evaluate to TRUE if the first 3 characters are a number AND the 4th character is a "-" The 4th, 10th, and 11th cells would be "FALSE"

    Does that work for you?
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  4. #4
    Registered User
    Join Date
    08-04-2009
    Location
    Golborne England
    MS-Off Ver
    2013
    Posts
    85

    Re: Identify Cells/Data that begin with 3 characters and a -

    Hi mnfez,

    try this paste it in the row with the first line of your data an it will return true or false if it matched your criteria. You will only need to adjust the "A7" address values to point to your first line of data. Then copy and paste it down the column.

    Please Login or Register  to view this content.
    JimBobBowie

  5. #5
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Identify Cells/Data that begin with 3 characters and a -

    If you don't want extra formulae/columns in your data, you can highlight the 'wrong' cells with Conditional Formatting.
    Click Conditional Formatting and select 'New Rule' then 'Use a formula to determine which cells to format'. Put the formula below into the formula box then choose how you want those cells highlighted (yellow fill, red text, whatever):
    =FIND("-",A1)<>4
    Then repeat with this formula:
    =ISERROR(FIND("-",A1))

    Edit:
    A better formula to use in the Cond Formatting would be one of these (amended from GeneralDisarray's and JimBobBowie's so kudos to them):
    =NOT(AND(NOT(ISERROR(LEFT(A16,3)*1)),MID(A16,4,1)="-"))
    =NOT(AND(ISNUMBER(LEFT(A28,3)*1),MID(A28,4,1)="-"))

    Regards,
    Aardigspook

    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark Thread as Solved'.
    You don't need to give me rep if I helped, but thanks are appreciated.
    Last edited by Aardigspook; 09-01-2015 at 09:40 AM. Reason: Suggest better CF formulae

+ 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] Identify cells that contain foreign (Chinese, Japanese) characters?
    By MetroBOS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-27-2015, 06:20 PM
  2. Identify junk characters in a excel
    By vaishalis in forum Excel General
    Replies: 8
    Last Post: 08-12-2013, 02:23 PM
  3. Text Filter-begin With... (multiple Begin Withs?)
    By hariexcel1987 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-02-2013, 02:12 PM
  4. Text Filter-Begin with... (multiple begin withs?)
    By flyflipper in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-16-2010, 06:29 PM
  5. Running Macros for all worksheets that begin with certain characters
    By undergraduate in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2010, 05:39 PM
  6. [SOLVED] Autofilter to search characters that begin with "* "
    By Barb Reinhardt in forum Excel General
    Replies: 1
    Last Post: 11-16-2005, 09:35 AM
  7. VBA - Identify Begin/End of Cell Ranges
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-26-2005, 11:05 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