+ Reply to Thread
Results 1 to 5 of 5

How to extract a number at a certain length out of a string

  1. #1
    Registered User
    Join Date
    09-07-2021
    Location
    Michigan, US
    MS-Off Ver
    365
    Posts
    35

    How to extract a number at a certain length out of a string

    Hi Guys,
    In the attached I am trying to extract numbers without 0 in front to column B.
    Any simple formula?

    Any help is greatly appreciated.

    Thank you!!
    Attached Files Attached Files

  2. #2
    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,754

    Re: How to extract a number at a certain length out of a string

    Power Query Solution

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    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

  3. #3
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    865

    Re: How to extract a number at a certain length out of a string

    Try,
    PHP Code: 
    =lookup(10^15,--left(a2,row($1:$15))) 
    Harry.

  4. #4
    Registered User
    Join Date
    04-13-2022
    Location
    Kristianstad, Sweden
    MS-Off Ver
    2007/2016
    Posts
    30

    Re: How to extract a number at a certain length out of a string

    The old fashion way

    SEARCH for ":" in the string
    Take LEFT off the string -1 of the search number.
    Convert the textstring to numbers with VALUE
    and the 0 disappears in the front.
    Formula in B2 and drag down

    =VALUE(LEFT(A2,SEARCH(":",A2)-1))

    Instead of VALUE you can write
    =0+LEFT(A2,SEARCH(":",A2)-1)
    =1*LEFT(A2,SEARCH(":",A2)-1)
    =--LEFT(A2,SEARCH(":",A2)-1)
    instead of SEARCH you can use FIND

    /LGS
    Last edited by LARS GULYAS; 01-19-2024 at 01:47 PM. Reason: extra formulas

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,475

    Re: How to extract a number at a certain length out of a string

    Since you are using XL365, this single formula in cell B2 will automatically process the entire specified range...

    =0+TEXTBEFORE(A2:A13,":")

+ 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] Extract string from variable length string
    By JeffGrant in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2021, 03:47 AM
  2. [SOLVED] Extract a variable length number from within a text string
    By Kirk3737 in forum Excel General
    Replies: 2
    Last Post: 10-27-2020, 02:27 PM
  3. [SOLVED] Extract variable length string
    By mintymike in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-10-2015, 12:01 PM
  4. [SOLVED] Extract text from end of string with varying length
    By reedersketer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2015, 05:16 PM
  5. [SOLVED] how to extract variable length string
    By isurunk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2014, 01:13 AM
  6. Extract variable length substring from a string
    By charron9 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-24-2013, 11:52 AM
  7. Extract Variable Length Text String
    By sshot1 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-12-2012, 06:21 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