+ Reply to Thread
Results 1 to 9 of 9

Formula to Truncate and Transpose

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Formula to Truncate and Transpose

    Hello:

    Please refer to attached file.
    I have Names in cell D2:D17 as shown.

    I need formula to truncate the names from second "_" until third "_" and get the names in cell E2:E17.
    Once the list is ready, i need to transpose the list and paste at at cell E25 as shown.

    Let me know if you have any questions.
    Thanks.
    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,671

    Re: Formula to Truncate and Transpose

    In E2

    =TRIM(MID(SUBSTITUTE(D2,"_",REPT(" ",250)),501,250))

    Copy down

    Select E2 range, copy then paste/transpose in E25

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,972

    Re: Formula to Truncate and Transpose

    To do the extract...
    F2=TRIM(MID(SUBSTITUTE($D2,"_",REPT(" ",LEN($D2))),LEN($D2)*(COLUMNS($D$2:F2)-1)+1,LEN($D2)))
    copied down

    Do do the transpose...
    E25=INDEX($E$2:$E$17,COLUMNS($A$1:A1))
    copied across
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  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,882

    Re: Formula to Truncate and Transpose

    As all the entries begin with the same 8 characters, you can use this in E2:

    =MID(D2,9,FIND("_",D2,9)-9)

    then copy down as required.

    Hope this helps.

    Pete

  5. #5
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Formula to Truncate and Transpose

    =trim(mid(substitute(substitute(d2,"_"," ")," ",rept(" ",len(d2))),len(d2)*2+1,len(d2)))

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Formula to Truncate and Transpose

    Hi John and FDibbins:

    Thanks a lot, works

    Riz

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Formula to Truncate and Transpose

    Hi Pete:

    Your solution also works...Great

    Riz

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

    Re: Formula to Truncate and Transpose

    Hi Riz,

    glad to help - thanks for the rep.

    If you just wanted to end up with the names transposed into E25 across, you can put this formula in E25:

    =MID(INDEX($D:$D,COLUMNS($D:E)),9,FIND("_",INDEX($D:$D,COLUMNS($D:E)),9)-9)

    then copy across as required.

    Hope this helps.

    Pete

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,972

    Re: Formula to Truncate and Transpose

    Happy to help and thanks for the feedback

+ 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. Formula to truncate
    By rizmomin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-18-2016, 01:47 AM
  2. [SOLVED] Truncate At Specific Character Formula - And More. - Help Needed.
    By TheProffesional in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-07-2013, 04:11 PM
  3. [SOLVED] Formula Needed To Truncate Postcodes
    By Dom2066 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-27-2012, 03:03 AM
  4. Truncate Name
    By ernestgoh in forum Excel General
    Replies: 3
    Last Post: 03-31-2006, 05:41 AM
  5. [SOLVED] truncate
    By Matt Lunn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 03:05 PM
  6. truncate
    By tamar in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. [SOLVED] truncate
    By tamar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-19-2005, 06:05 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