+ Reply to Thread
Results 1 to 12 of 12

Simplier 'FIND' between comma's formula?

  1. #1
    Registered User
    Join Date
    06-08-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    44

    Question Simplier 'FIND' between comma's formula?

    Hey all,

    I've got a string of text in column A, such as below from which I want the numbers 58791 between commas 2 and 3.

    Please Login or Register  to view this content.
    I have been able to do so using the formula below, however was wondering if there was a more condensed way of going about things?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Simplier 'FIND' between comma's formula?

    Just a suggestion

    If the number is ALWAYS between commas 2 and 3 you could use Text to Columns which will do the job for you.

    You should supply more test data than just a single line or at least specify that the number will always be between commas 2 and 3.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    06-08-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    44

    Re: Simplier 'FIND' between comma's formula?

    Sorry yes, the number returned will always be between commas 2 and 3.

    I should have mentioned that while there is the option to use text to columns, I'm unable to as I need to return the whole string line in another worksheet using an Index Match Lookup using the middle number.

    Sheet 1
    A B
    Line1,ABCDORG,1234567,Test Data, Test Addrress 1234567
    Line1,ABCDORG,15485,Test Data, Test Addrress 15485
    Line1,ABCDORG,68787,Test Data, Test Addrress 68787

    Sheet 2

    A B
    15485 Line1,ABCDORG,15485,Test Data, Test Addrress
    Where B contains an Index/Match for lookup in 'Sheet 1' Column B returning Sheet 1 Column A.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Simplier 'FIND' between comma's formula?

    maybe like this.

    but I doubt it is easier.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Simplier 'FIND' between comma's formula?

    Quote Originally Posted by DHHM View Post
    I should have mentioned that while there is the option to use text to columns, I'm unable to as I need to return the whole string line in another worksheet using an Index Match Lookup using the middle number.
    Why does that mean you can't use Text To Columns?

    Text to columns doesn't have to be 'destructive' of the original data.
    You can specify to put the results in another area of your sheet, leaving the original data in tact.

    On the 3rd screen in the wizard, there's a box called 'Destination'
    That can be anywhere you choose on the sheet.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simplier 'FIND' between comma's formula?

    Will any of the number strings start with leading zeros?

    Data Range
    A
    B
    1
    2
    Line1,ABCDORG,1234567,Test Data, Test Addrress
    1234567
    3
    Line1,ABCDORG,15485,Test Data, Test Addrress
    15485
    4
    Line1,ABCDORG,68787,Test Data, Test Addrress
    68787


    This formula entered in B2 and copied down:

    =--TRIM(MID(SUBSTITUTE(A2,",",REPT(" ",100)),200,100))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    06-08-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    44

    Re: Simplier 'FIND' between comma's formula?

    Quote Originally Posted by Jonmo1 View Post
    Why does that mean you can't use Text To Columns?

    Text to columns doesn't have to be 'destructive' of the original data.
    You can specify to put the results in another area of your sheet, leaving the original data in tact.

    On the 3rd screen in the wizard, there's a box called 'Destination'
    That can be anywhere you choose on the sheet.
    I had no idea you could do that.

  8. #8
    Registered User
    Join Date
    06-08-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    44

    Re: Simplier 'FIND' between comma's formula?

    Quote Originally Posted by Tony Valko View Post
    Will any of the number strings start with leading zeros?

    Data Range
    A
    B
    1
    2
    Line1,ABCDORG,1234567,Test Data, Test Addrress
    1234567
    3
    Line1,ABCDORG,15485,Test Data, Test Addrress
    15485
    4
    Line1,ABCDORG,68787,Test Data, Test Addrress
    68787


    This formula entered in B2 and copied down:

    =--TRIM(MID(SUBSTITUTE(A2,",",REPT(" ",100)),200,100))
    No leading zereos. Hows doe sthe 'REPT' function fit in with this formulae?

  9. #9
    Registered User
    Join Date
    06-08-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    44

    Re: Simplier 'FIND' between comma's formula?

    Quote Originally Posted by oeldere View Post
    maybe like this.

    but I doubt it is easier.
    Thanks mate. :D

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simplier 'FIND' between comma's formula?

    It virtually replaces the commas in the string with 100 space characters.

    Assume the underscores represent 100 space characters:

    Line1___ABCDORG___1234567___Test Data___ Test Addrress

    This string is then parsed by the MID( ) function. It gets reduced to:

    ___1234567___

    Then the TRIM( ) function strips off all the leading/trailing space characters and leaves us with:

    1234567

  11. #11
    Registered User
    Join Date
    06-08-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    44

    Re: Simplier 'FIND' between comma's formula?

    Thanks again, much appreciated.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simplier 'FIND' between comma's formula?

    You're welcome!

+ 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] How to find the last word after last comma
    By turist in forum Excel General
    Replies: 6
    Last Post: 01-20-2014, 09:39 AM
  2. Find and remove all text to the left of last comma (including comma) in a cell
    By Excelrookie_1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-05-2013, 08:47 AM
  3. [SOLVED] If comma present, then place a character before and after comma (FORMULA)
    By jaimealvarez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2012, 04:04 PM
  4. simplier method for if,else statement
    By etsusurveyor in forum Excel General
    Replies: 1
    Last Post: 07-10-2007, 10:10 AM
  5. [SOLVED] find and remove a string of a cell value with comma as delimiter
    By yefei in forum Excel General
    Replies: 3
    Last Post: 02-28-2006, 09:10 AM
  6. Find the sum of Comma Seperated Values In a Cell
    By xcelion in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 09:05 PM
  7. Macro to find a comma in a string
    By Chuck in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-23-2005, 11:05 PM
  8. copying made simplier
    By msam137 in forum Excel General
    Replies: 3
    Last Post: 03-03-2005, 05:06 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