+ Reply to Thread
Results 1 to 11 of 11

Sort numbers in ascending order and the concatenate

Hybrid View

  1. #1
    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
    =INDEX(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20))&" "&TRIM(MID(SUBSTITUTE("|"&B3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(B3)-LEN(SUBSTITUTE(B3,"|","")))+1))*20,20)),MATCH(TRUE,SMALL(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),1)=--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),0))&"|"&INDEX(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20))&" "&TRIM(MID(SUBSTITUTE("|"&B3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(B3)-LEN(SUBSTITUTE(B3,"|","")))+1))*20,20)),MATCH(TRUE,SMALL(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),2)=--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),0))&"|"&INDEX(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20))&" "&TRIM(MID(SUBSTITUTE("|"&B3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(B3)-LEN(SUBSTITUTE(B3,"|","")))+1))*20,20)),MATCH(TRUE,SMALL(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),3)=--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),0))&"|"&INDEX(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20))&" "&TRIM(MID(SUBSTITUTE("|"&B3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(B3)-LEN(SUBSTITUTE(B3,"|","")))+1))*20,20)),MATCH(TRUE,SMALL(--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),4)=--(MID(SUBSTITUTE("|"&A3,"|",REPT(" ",20)),ROW(INDIRECT("1:"&(LEN(A3)-LEN(SUBSTITUTE(A3,"|","")))+1))*20,20)),0))
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    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

  2. #2
    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

+ 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