+ Reply to Thread
Results 1 to 9 of 9

Extract first 4 digits in excel string without using VBA

  1. #1
    Registered User
    Join Date
    10-25-2017
    Location
    United States
    MS-Off Ver
    2019
    Posts
    77

    Extract first 4 digits in excel string without using VBA

    I am trying to extract the first 4 digits within an excel string that have varying entry lengths/formats. I am looking for a formula based solution to achieve this result and would like to not use a VBA. Here are some example cell values:

    Pro $1,000
    Extra Pro $2,700-45% Freeze
    Platinum.500.50.1000

    Desired results:
    1000
    2700
    0500 - If 500 is the only achievable answer, that will work as well

    Here is the formula that I am using, which extracts every single number instead of the first 4:
    Please Login or Register  to view this content.
    The above formula produces:
    1000
    270045
    500501000

    Any help is appreciated!

  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: Extract first 4 digits in excel string without using VBA

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

    v H I
    32
    33 Pro $1,000 1000
    34 Extra Pro $2,700-45% Freeze 2700
    35 Platinum.500.50.1000 500
    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
    Registered User
    Join Date
    10-25-2017
    Location
    United States
    MS-Off Ver
    2019
    Posts
    77

    Re: Extract first 4 digits in excel string without using VBA

    Thank you for the response Alkey! The examples I gave work perfectly with the formula provided, but I am having some issues with other cell strings including:

    BL 1000-30-55% Orange (the formula provided a #VALUE! error)
    BL Hatch. 4550-40% Silver (the formula provided a #VALUE! error)

    Do you know why the formula would provide an error even though there are 4 digits?

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Extract first 4 digits in excel string without using VBA

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

    with Control+Shift+Enter
    Attached Files Attached Files

  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: Extract first 4 digits in excel string without using VBA

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

    v H I
    32
    33 Pro $1,000 1000
    34 Extra Pro $2,700-45% Freeze 2700
    35 Platinum.500.50.1000 500
    36 BL 1000-30-55% Orange 1000
    37 BL Hatch. 4550-40% Silver 4550
    38

  6. #6
    Registered User
    Join Date
    10-25-2017
    Location
    United States
    MS-Off Ver
    2019
    Posts
    77

    Re: Extract first 4 digits in excel string without using VBA

    Thank you sandy666! The formula provided works great with my most recent post, but it does not work with this example since its only first 3 digits instead of 4:

    Platinum.500.50.1000 (Formula provides an answer of 5005 instead of 500)

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract first 4 digits in excel string without using VBA


  8. #8
    Registered User
    Join Date
    10-25-2017
    Location
    United States
    MS-Off Ver
    2019
    Posts
    77

    Re: Extract first 4 digits in excel string without using VBA

    Thank you both, AlKey and sandy666! both you helped solve my question, much appreciated!

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract first 4 digits in excel string without using VBA

    You are welcome, thanks for rep

+ 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. Excel Formula to extract last digits from text string
    By tunafishco in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-13-2017, 12:21 AM
  2. [SOLVED] UDF to extract digits from variable range string
    By Excel2010101 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-28-2014, 03:41 PM
  3. Replies: 14
    Last Post: 03-08-2014, 03:25 PM
  4. [SOLVED] How to extract digits from a string?
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2013, 09:28 AM
  5. [SOLVED] Excel 2007 : Extract last four digits from alphanumberical string
    By questionguy in forum Excel General
    Replies: 5
    Last Post: 07-16-2012, 12:51 PM
  6. Replies: 11
    Last Post: 11-16-2011, 12:56 PM
  7. Formula to extract digits from a text string?
    By Hash@example.org in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-15-2006, 12:16 AM

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