+ Reply to Thread
Results 1 to 6 of 6

Struggling to maintain formatting when using textjoin

  1. #1
    Registered User
    Join Date
    05-31-2024
    Location
    York, England
    MS-Off Ver
    2019
    Posts
    3

    Struggling to maintain formatting when using textjoin

    I have an invoice/quote which is 10 pages long, the main text area of the invoice/quote is made of 3 columns (B, C-G (merged) and H). Column B contains dates or blanks if its an invoice or numeric task list if a quote(if B4="Invoice" or "quote"), Column C is for description and Column H is for cost. To reduce the number of cells to store each invoice on another worksheet(currently 2249 cells wide). I would like to store the data from B27:H54 (page 1 data) in a single cell using textjoin. The problem is the datatype, B=Date formatted as "dd mmm yyyy" or "General" if is quote, C-G = general and H is formatted as currency. All cells may contain data or be blank, but blanks must be kept. Once the formula works I can repeat it for pages 2 to 10.

    =TEXTJOIN(",",FALSE,B27:H54) - this works, joining all the cells into one but the date is displayed as 45413 etc

    The perfect result would be "Row 27 Date (as "dd mmm yyyy"), Row 27 Description, Row 27 Cost, Row 28 Date, Row 28 Description, Row 28 Cost, Row 29 Date, Row 29 Description, Row 29 Cost" etc
    but I could also manage with 3 cells with all the Col 27-54 - ie "Row 27 Date, Row 28 Date, Row 29 Date" "Row 27 Desc, Row 28 Desc, Row 29 Desc" "Row 27 Cost, Row 28 Cost, Row 29 Cost"

    I suspect the second result would make loading / saving the data quicker

    I have not included all my other more complicated textjoin attempts as the all fail with "#value"
    Last edited by JohnCollins; 05-31-2024 at 07:38 AM. Reason: wrong cells entered

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,800

    Re: Struggling to maintain formatting when using textjoin

    Welcome to the forum.

    =TEXTJOIN(",",FALSE,B27:H54) - this works, joining all the cells into one but the date is displayed as 45413 etc
    Set the cell formatting to SHORT DATE.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    05-31-2024
    Location
    York, England
    MS-Off Ver
    2019
    Posts
    3

    Re: Struggling to maintain formatting when using textjoin

    Thanks Ali for helping. I have had to used the "dd mmm yyyy" format in my "invoice database" as excel has had a habit of transposing the dates to USA format randomly,
    especially when the raw data is saved and reloaded from CSV files. I not entirely sure what you mean regarding "Short Dates" as I tried to change both the source and recipient cells format
    and I still get the same result.

    I have attached a small excel sample of the worksheet.

    Kind regards
    John

    Sample.xlsx

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,800

    Re: Struggling to maintain formatting when using textjoin

    If you have dates coming from the US, make sure that you are getting the days and months the right way round! US default format is m/d/yyyy.

    Try this:

    =TEXTJOIN(" ↓ ",1,TEXT(TOCOL(B27:B54,1),"dd/mm/yyyy"))

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,873

    Re: Struggling to maintain formatting when using textjoin

    I think you were pretty close. Try for instance:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As you declare you are using version 2019 it could require not just Enter but Ctrl+Shift+Enter to commit array formula*

    See the attached file and try to edit formula.

    HAve a look also on other formulas


    PS. TOCOL will probably not work because it's Excel 2019 (I think TOCOL is only available in Excel 365 and web version)


    ---- out of our canned replies set ----
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Attached Files Attached Files
    Best Regards,

    Kaper

  6. #6
    Registered User
    Join Date
    05-31-2024
    Location
    York, England
    MS-Off Ver
    2019
    Posts
    3

    Re: Struggling to maintain formatting when using textjoin

    Thanks to both Ali and Kaper for there help. Kaper's solution worked best due to the 2019 version not having TOCOL

+ 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. Struggling with Conditional Formatting based on IF
    By harrylucas in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-14-2023, 06:13 PM
  2. Maintain source formatting
    By macrorookie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2023, 05:15 AM
  3. Struggling with formatting this field.
    By mcclungaa in forum Excel General
    Replies: 5
    Last Post: 10-11-2021, 11:24 PM
  4. [SOLVED] TEXTJOIN and keep formatting
    By ihb95 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-09-2019, 03:16 AM
  5. Struggling with dropdown menu and conditional formatting
    By exced in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-18-2016, 11:01 AM
  6. [SOLVED] Struggling with conditional formatting rules
    By tempef in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-17-2015, 08:55 AM
  7. Struggling with Conditional Formatting
    By edwardpestian in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-17-2007, 03:32 PM

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