+ Reply to Thread
Results 1 to 6 of 6

Requesting Formula for Re-Formatting Text

  1. #1
    Registered User
    Join Date
    04-01-2014
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    6

    Requesting Formula for Re-Formatting Text

    I have a block of text in the following format:

    DOE, JOHN

    12345 MAIN ST
    STE 320
    OAKLAND, CA 12345

    P: 1234567890
    F: 0987654321

    Service Date
    01/11/2019 ~ 11/11/2019

    I have to re-format this text two ways:

    1. In a single line, with the following result:

    DOE, JOHN, 12345 MAIN ST STE 320, OAKLAND, CA 12345, (123)456-7890

    2. In a block, with the following result:

    DOE, JOHN
    12345 MAIN ST STE 320
    OAKLAND, CA 12345
    P: 1234567890
    F: 0987654321
    Service Date: 01/11/2019 ~ 11/11/2019

    Every detail must appear as shown, including parentheses, or lack thereof, removing line spaces, etc.

    Can anyone help me produce some formulas to re-format the text in both ways?

    Note: This needs to be done just using formulas (no macros, VBA, etc.). Work computer will not allow anything fancy.

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

    Re: Requesting Formula for Re-Formatting Text

    Have you tried Data/Data Tools/Remove Duplicates. This should leave you with 1 row that you would need to delete manually.
    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

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Requesting Formula for Re-Formatting Text

    cells A1 to A11 were populated when I pasted your example into a worksheet

    This formula in B1 returned what you requested
    =TRIM(A1&", "&A3&" "&A4&", "&A5&", "&"("&MID(A7,4,3)&")"&MID(A7,7,3)&"-"&MID(A7,10,4))

    Excel 2016 (Windows) 32 bit
    A
    B
    1
    DOE, JOHN DOE, JOHN, 12345 MAIN ST STE 320, OAKLAND, CA 12345, (123)456-7890
    2
    3
    12345 MAIN ST
    4
    STE 320
    5
    OAKLAND, CA 12345
    6
    7
    P: 1234567890
    8
    F: 0987654321
    9
    10
    Service Date
    11
    01/11/2019 ~ 11/11/2019
    Sheet: Sheet1

    OR
    if you start by removing duplicates (as suggested by @FDibbins), formula becomes
    =TRIM(A1&", "&A2&" "&A3&", "&A4&", "&"("&MID(A5,4,3)&")"&MID(A5,7,3)&"-"&MID(A5,10,4))

    Excel 2016 (Windows) 32 bit
    A
    B
    1
    DOE, JOHN DOE, JOHN, 12345 MAIN ST STE 320, OAKLAND, CA 12345, (123)456-7890
    2
    12345 MAIN ST
    3
    STE 320
    4
    OAKLAND, CA 12345
    5
    P: 1234567890
    6
    F: 0987654321
    7
    Service Date
    8
    01/11/2019 ~ 11/11/2019
    Sheet: Sheet2
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    04-01-2014
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Requesting Formula for Re-Formatting Text

    Brilliant! Thank you so much!

  5. #5
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Requesting Formula for Re-Formatting Text

    I don't think just removing duplicates produces the required "block" output (if that was the intent).
    - "STE 320" needs to follow the street address on the same line
    - Service Date & ": " and the pair of dates needs to be on the same line

    Starting with Kev's SHEET1 layout, in cell C1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Make sure that "Wrap text" is on for cell C1 and that it is wide enough to accommodate each line's width.

  6. #6
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Requesting Formula for Re-Formatting Text

    @H3br3wHamm3r81 - thanks for the rep points

+ 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. [SOLVED] Requesting assistance in cleaning up some text import VBA
    By #DIV/0! in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-18-2017, 04:11 AM
  2. [SOLVED] Web Query Requesting Import Text File Upon Refresh
    By lekiw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2016, 07:15 PM
  3. Requesting some help with regards to a vlookup formula
    By Jman2102 in forum Excel General
    Replies: 11
    Last Post: 11-28-2016, 05:20 PM
  4. [SOLVED] Requesting help returning text values from criteria based on multiple columns
    By dzarrabi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2013, 08:16 AM
  5. [SOLVED] Requesting for a formula to retun text.
    By lifeisaspreadsheet in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 04-14-2013, 11:43 AM
  6. Requesting conditional formatting assistance
    By xdennis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-26-2013, 09:55 AM
  7. [SOLVED] requesting formula for distributing a number
    By julie in forum Excel General
    Replies: 5
    Last Post: 08-21-2006, 04:45 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