+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Returning numeric characters within a field

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Returning numeric characters within a field

    Hi

    Please could some body assist me with the following challange I have.

    I am importing a large amount of data into a system from Excel that reads a field and takes the first 8 numeric characters it finds and uses them as the date.
    Unfortunately this relies on humans making sure they use the date as the first 8 numerics!

    I have approx 400,000 lines of data and it is failing on an invalid date so I was thinking if I could use a formula to pull the first 8 numeric from the field I could then filter it and find the errors.

    Two examples of the data in the field I am looking at are

    EXCH GAINS/LOSSES 31/10/2011 (The answer is 31102011)
    14/12/2011 0 109247 (The answer is 14122011)

    Thank you for your help.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Returning numeric characters within a field

    hi joelane, welcome to the forum. your scenarios may be too unpredictable since you mentioned it's keyed by humans. i can only give you solutions based on what you provided. but it may not be applicable for the rest of your scenarios. I'm assuming 4 things:
    1) the dates are either in front or at the back.
    2) the slash "/" is only used for texts or dates
    3) dates are always in the format of dd/mm/yyyy
    4) info starts from A1

    try:
    =IF(FIND("/",A1)=3,TEXT(LEFT(A1,10),"ddmmyyyy"),TEXT(RIGHT(A1,10),"ddmmyyyy"))

    if all years are in 2011, you can try this too:
    =MID(A1,FIND("/2011",A1)-5,10)

    hope it helps.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

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

    Re: Returning numeric characters within a field

    @benishiryo
    Your second assumption fails on OP's first sample.

    If all dates are after Jan 1, 2000 and have 2 digits for all days and months you can try:

    =SUBSTITUTE(MID(A2,FIND("/20",A2)-5,10),"/","")
    Last edited by Cutter; 06-11-2012 at 07:10 AM.

  4. #4
    Registered User
    Join Date
    06-11-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Returning numeric characters within a field

    Thank you so much for resolving this for me.

    I managed to fudge through it using the MID formula as the dates can be anywhere in the string.


  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Returning numeric characters within a field

    @cutter
    ahhh my 2nd formula? you're right. forgot about the slashes

+ 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