+ Reply to Thread
Results 1 to 6 of 6

Break out numerical values from a string

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    289

    Break out numerical values from a string

    Hello,
    My data is written in the following format:
    "numerical value" & "minus sign" & "numerical value", like
    25-120
    or
    2-8
    etc.
    I need a macro which returns the two numerical values (one on the left of the "minus sign" and the other, from the right of the "minus sign" like:

    25
    120

    or

    2
    8

    Please advise,
    Thank you!

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    5,593

    Re: Break out numerical values from a string

    Suppose 25-120 in A1
    Put this formula in B1
    Please Login or Register  to view this content.
    and this formula in C1
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit My Blog : From Here

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    5,593

    Re: Break out numerical values from a string

    And if you would like to use VBA you can try
    Please Login or Register  to view this content.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4,537

    Re: Break out numerical values from a string

    Or this maybe.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    12,063

    Re: Break out numerical values from a string

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    12,063

    Re: Break out numerical values from a string

    plans,

    Thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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