+ Reply to Thread
Results 1 to 9 of 9

Left and Right commands for getting numbers before and after specific special characters

  1. #1
    Registered User
    Join Date
    07-16-2011
    Location
    Lahore, Pakistan
    MS-Off Ver
    Excel 2003
    Posts
    15

    Left and Right commands for getting numbers before and after specific special characters

    Hi,

    Please see the attached sheet. I have a long list of values in Column "A" where two different values are entered in same cell separated by "------".

    I want to get the value before "------" and after "------" in two separate cells.

    I've successfully got the left side value in "B" column with "=LEFT(A2,FIND("-",A2,1)-1)" formula but don't know how to get the value after "-------" in "C" column.

    Please help.

    Regards,

    Shakeel
    Attached Files Attached Files
    Shakeel Ahmad
    www.facebook.com/shakeelahmad215

  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: Left and Right commands for getting numbers before and after specific special characte

    Enter formula in B2 and drag formula cross to C2 and down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 K-----M K M
    2 9-----13 9 13
    3 91-----13 91 13
    4 9-------3 9 3
    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
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Left and Right commands for getting numbers before and after specific special characte

    There's probably a better way to do it, but this will do what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Left and Right commands for getting numbers before and after specific special characte

    You can put this in C2:

    =SUBSTITUTE(RIGHT(A2,LEN(A2)-FIND("-----",A2)-4),"-","")

    then copy down. If you want the result as a proper number, then you can add +0 or *1 at the end (and to the end of your existing formula).

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    07-16-2011
    Location
    Lahore, Pakistan
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Left and Right commands for getting numbers before and after specific special characte

    Thanks AlKey! Your formula worked for me.
    Thanks Aardigspook! Your formula also worked for me.

    Thanks Pete_UK! But in the list number of "------" are not same in all cells. The person who made the list did not take care of this.

    Thanks to all of you!

    Regards,

  6. #6
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: Left and Right commands for getting numbers before and after specific special characte

    OR,

    Try the following in C2:

    =--RIGHT(SUBSTITUTE(A2,"-",""),LEN(SUBSTITUTE(A2,"-",""))-LEN(B2))

  7. #7
    Registered User
    Join Date
    07-16-2011
    Location
    Lahore, Pakistan
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Left and Right commands for getting numbers before and after specific special characte

    Quote Originally Posted by cbatrody View Post
    OR,

    Try the following in C2:

    =--RIGHT(SUBSTITUTE(A2,"-",""),LEN(SUBSTITUTE(A2,"-",""))-LEN(B2))
    This is the easiest method that I can understand easily and it solved my problem. The other formulas worked too but are difficult to understand for a common man like me.

    Thank you!

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Left and Right commands for getting numbers before and after specific special characte

    or try below
    =TRIM(RIGHT(SUBSTITUTE(A2,"-",REPT(" ",15)),15))
    or
    =ABS(LOOKUP(99^9,RIGHT(A2,ROW(A$1:A$15))+0))
    Last edited by samba_ravi; 01-25-2018 at 03:07 AM.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  9. #9
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Left and Right commands for getting numbers before and after specific special characte

    Glad we could help and thanks for the rep.

    If that has solved your problem, please take a moment to mark the thread as Solved so others know there's an answer here (see instructions in my signature). Thank you.

+ 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] Cell Restrictions allow only numbers, no special characters
    By karimel_romeo in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 05-07-2015, 01:56 AM
  2. [SOLVED] Average calculation of numbers with special characters
    By Ash248 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-06-2013, 06:47 PM
  3. [SOLVED] Calculating the average for numbers with special characters.
    By Ash248 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-06-2013, 01:10 PM
  4. [SOLVED] i want re alter my numbers with special characters
    By vengatvj in forum Excel General
    Replies: 20
    Last Post: 09-30-2013, 06:51 PM
  5. How to calculate only values with numbers not special characters like!
    By toplisek in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2013, 06:43 AM
  6. [SOLVED] find word in string, count how many special characters are to its left
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2013, 06:46 PM
  7. [SOLVED] remove spaces (special characters) after numbers
    By fareastwarriors in forum Excel General
    Replies: 13
    Last Post: 11-04-2012, 09:25 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