+ Reply to Thread
Results 1 to 11 of 11

Sort numbers in ascending order and the concatenate

  1. #1
    Registered User
    Join Date
    06-05-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Sort numbers in ascending order and the concatenate

    This is what I have in my two columns:-

    Column A Column B
    Medicine ID Medicine weight
    1326| 323| 1442| 199 500mg|2mg|60mg|30mg
    1321| 320| 2447| 1442 125mg|2mg|60mg|30mg
    100| 323| 1362| 152 500mg|2mg|10mg|30mg


    This is what I want:-

    Medicine ID|Medicine weight
    199 30mg|323 2mg|1326 500mg|1442 60mg
    320 2mg|1321 125mg|1442 30mg|2447 60mg
    100 500mg|152 30mg|323 2mg |2447 60mg

    Column A contains Medicine ID
    Column B contains Medicine weight
    I want to Sort Medicine ID in ascending order and concatenate with its appropriate weight.


    Thanks in advance !
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Sort numbers in ascending order and the concatenate

    You need to use VBA for this thing

    it is possible using formulas too but will take a lot of time.
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Sort numbers in ascending order and the concatenate

    Copy paste below in D1 then hold control and shift then hit enter to make it array formula.
    This formula will work for 4 medicine ID's and 4 Weight

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

  4. #4
    Registered User
    Join Date
    06-05-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Sort numbers in ascending order and the concatenate

    Thanks Its working... but in my data number of medicine IDs varies from 1 to 15 and have same number of Medicine Weights. How to use this formula for such cases ???

    Example Data:-

    Medicine ID Medicine weight
    1326| 323| 1442| 500mg|2mg|60mg
    1321| 320| 2447| 1442 125mg|2mg|60mg|30mg
    100 500mg

  5. #5
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Sort numbers in ascending order and the concatenate

    as far as i know then you need to use VBA for that case.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Sort numbers in ascending order and the concatenate

    You should have been more clear in your original post. Hemesh will have spent a lot of time putting together his formula. You will need VBA to do this; not a formula. A formula solution is very unlikely to be practical.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  7. #7
    Registered User
    Join Date
    06-05-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Sort numbers in ascending order and the concatenate

    I'm sorry for not being very specific with my issue. I hope I will get help.

    can I get Different different formulas for different number of Medicine IDs ?

    i.e
    1. Formula for 2 Mdicine IDs
    2. Formula for 3 Mdicine IDs
    3. Formula for 4 Mdicine IDs
    4. Formula for 5 Mdicine IDs..... upto 15 Medicine IDs
    Last edited by sandubandu; 01-16-2016 at 01:34 AM.

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

    Re: Sort numbers in ascending order and the concatenate

    UDF
    Use in cell like
    =ConcSort(A3,B3,"|")
    and filldown
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-05-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Sort numbers in ascending order and the concatenate

    could you please tell me How to use this code ?

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

    Re: Sort numbers in ascending order and the concatenate

    ................................
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-05-2012
    Location
    mumbai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Sort numbers in ascending order and the concatenate

    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. Sort the final digits and sort in ascending order
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2014, 11:58 AM
  2. [SOLVED] Sort in ascending order
    By Glenn Kennedy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-07-2013, 08:11 AM
  3. [SOLVED] Sort Ascending order
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2013, 02:27 PM
  4. [SOLVED] Sort in ascending order
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-17-2013, 12:30 AM
  5. Replies: 0
    Last Post: 07-11-2012, 08:28 PM
  6. Sort the numbers in ascending order by lines
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-15-2012, 04:54 PM
  7. sort ascending order
    By iscar_marius in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-11-2009, 11:00 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