+ Reply to Thread
Results 1 to 7 of 7

Sort text with number as prefix within a cell

  1. #1
    Registered User
    Join Date
    12-14-2022
    Location
    Canada
    MS-Off Ver
    O365
    Posts
    3

    Sort text with number as prefix within a cell

    Hello!

    Let's say I want to generate a product name following the composition of raw materials.
    AA, BB, CC, DD, EE and FF are the components.
    50, 100, 8, 12, 1 and 2 are the quantities.

    To get a name with the most present component at the begining, I would like to sort ascending the data inside cells S1 and S3.

    The formula I founded (Classeur4.xlsx) works pretty well, but it's more complicated when I have a number below 10.

    Do you think there is a workaround to do that?

    Thanks!

  2. #2
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,390

    Re: Sort text with number as prefix within a cell

    Here is a solution without helpers and most present component first:

    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 12-15-2022 at 03:35 AM.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Sort text with number as prefix within a cell

    In N2 copied to other range.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    12-14-2022
    Location
    Canada
    MS-Off Ver
    O365
    Posts
    3

    Re: Sort text with number as prefix within a cell

    Awesome HansDouwe !! That's absolutely perfect!!

    Thanks kvsrinivasamurthy, but I think there is a glitch in your formula because it's no sorted :/

    Thanks all!

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Sort text with number as prefix within a cell

    The formula gives the expected result you have shown in file.

  6. #6
    Registered User
    Join Date
    12-14-2022
    Location
    Canada
    MS-Off Ver
    O365
    Posts
    3

    Re: Sort text with number as prefix within a cell

    Look at this screenshot.
    On the left, it's your formula, and on the right the one from HansDouwe.

    With yours, it's not sorted.
    It's
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.
    Or did I missed something?

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,390

    Re: Sort text with number as prefix within a cell

    You are welcome, thanks for the feedback and rep . Glad to have helped.

+ 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. Extract Number with Prefix from Text
    By myou in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-22-2020, 07:26 PM
  2. [SOLVED] add prefix to number based on validation from other data if found prefix 0, do nothing
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2018, 11:52 AM
  3. [SOLVED] Sort column with VBA by prefix and then by number
    By chrisignm in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-17-2016, 08:20 AM
  4. [SOLVED] Incrementing a cell value that has a text prefix and number
    By RM05067 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2016, 03:33 AM
  5. creating sequential number with text prefix
    By j_r_m_c in forum Excel General
    Replies: 3
    Last Post: 07-04-2014, 09:42 AM
  6. [SOLVED] Looking for same number but different prefix and add cell contents
    By Smudge.Smith in forum Excel General
    Replies: 8
    Last Post: 10-31-2012, 07:53 AM
  7. Adding prefix text to cell value
    By auntsally in forum Excel General
    Replies: 3
    Last Post: 03-26-2008, 06:00 AM

Tags for this Thread

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