+ Reply to Thread
Results 1 to 11 of 11

compare 2 different numbers and copy the last 3 digits.

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    Mos Eisly
    MS-Off Ver
    Excel 2007
    Posts
    39

    Exclamation compare 2 different numbers and copy the last 3 digits.

    Hi can someone help me with this:
    It's difficult to explain so I will just give an example with what I need as end result:
    A
    123456
    987123
    456963

    B
    123965
    987582
    456123


    I need in C
    123456-965
    987123-582
    456123-963 (hier you see I began with the number in B than the 3 digits from A because the number 456123 < than the 456963 in A)

    in the attachement I've uploaded an example, the red column C is what I need
    Attached Files Attached Files
    Last edited by Aranell; 06-27-2013 at 06:50 AM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: compare 2 different numbers and copy the last 3 digits.

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    [EDIT]
    We are editing out of sync...

    Try this in C1, Drag/Fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Marcol; 06-27-2013 at 06:53 AM.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: compare 2 different numbers and copy the last 3 digits.

    Perhaps

    =MIN(A1:B1)&"-"&RIGHT(MAX(A1:B1),3)

  4. #4
    Registered User
    Join Date
    11-16-2012
    Location
    Mos Eisly
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: compare 2 different numbers and copy the last 3 digits.

    hmm both didn't work:
    the first "the formula you typed contains an error"
    the second just don't give me the result I need

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: compare 2 different numbers and copy the last 3 digits.

    Quote Originally Posted by Aranell View Post
    the second just don't give me the result I need
    This kind of comment doesn't help at all.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: compare 2 different numbers and copy the last 3 digits.

    Quote Originally Posted by Aranell View Post
    hmm both didn't work:
    the first "the formula you typed contains an error"
    the second just don't give me the result I need
    Both seem to work for me

    Go with Jindon, it's shorter.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  7. #7
    Registered User
    Join Date
    11-16-2012
    Location
    Mos Eisly
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: compare 2 different numbers and copy the last 3 digits.

    Quote Originally Posted by jindon View Post
    This kind of comment doesn't help at all.


    Well let we say I have in
    A
    123456

    and in B
    123956

    I get in C
    123456-8

  8. #8
    Registered User
    Join Date
    11-16-2012
    Location
    Mos Eisly
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: compare 2 different numbers and copy the last 3 digits.

    Quote Originally Posted by Marcol View Post
    Both seem to work for me

    Go with Jindon, it's shorter.

    great
    now I need it in VBA

    I'll tray my self

  9. #9
    Registered User
    Join Date
    11-16-2012
    Location
    Mos Eisly
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: compare 2 different numbers and copy the last 3 digits.

    OK I've manage it to work... halfway:

    Cells(3, 1).Value = (Application.Min(TextBox1.Value, TextBox2.Value) & "-" & Right(Application.Max(TextBox1.Value, TextBox2.Value), 3))


    I just discovered some issue, which i didn't take in considiration before...

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: compare 2 different numbers and copy the last 3 digits.

    I would write like this
    Please Login or Register  to view this content.
    TextBox?...

  11. #11
    Registered User
    Join Date
    11-16-2012
    Location
    Mos Eisly
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: compare 2 different numbers and copy the last 3 digits.

    Quote Originally Posted by jindon View Post
    I would write like this
    Please Login or Register  to view this content.
    TextBox?...

    Great it works fine

    about the TextBox: well actually what I want is to enter 2 numbers from a userform, and if the first digits much together than it it will be saved on a the sheet on the way like

+ 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