+ Reply to Thread
Results 1 to 3 of 3

Concatenate

  1. #1
    Registered User
    Join Date
    05-18-2009
    Location
    Saint John, NB
    MS-Off Ver
    Excel 2003
    Posts
    3

    Concatenate

    Hi,

    I am trying to merge the data from 4 different cells into one blank cell in the same worksheet and then carry this down for each row in the table.

    Here are the conditions:

    • The data to merge will be dates with labels (eg. Date 1 - 1/20/2009, Date 2 - 6/5/2009 etc.)
    • Some, or all cells in a row may be empty
    • Merged cell will only show data that is visible (blank cells are omitted)
    • If the data resides in columns A-D and A,C and D are populated the result would show Date 1, Date 3 and Date 4 each with their respective label

    The stakeholder for this only wants the data visible to be shown and each date will have a label to identify it based on the column header of the column it came from. I have managed to use the CONCATENATE and TEST functions to show the results from every cell but get blank cells showing up as 1/01/1900.

    I know that I can write a series of IF statements, but the whole thing would be quite large, complex and exceed the 7 nested statements. I know that there must be a simpler way to execute this, but it is escaping me.

    If anyone could provide some assistance on this, it would be greatly appreciated

    Thanks,

    Jeff

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Concatenate

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate

    It's not elegant, but it works and it's fast and not volatile. For date values in A2:D2...put this formula in E2. Copy down to get your formatted dates with labels.

    =SUBSTITUTE(TRIM(IF(A2<>"", "Date 1 - " & TEXT(A2, "M/D/YYY"), "") & IF(B2<>"", " Date 2 - " & TEXT(B2, "M/D/YYY"), "") & IF(C2<>"", " Date 3 - " & TEXT(C2, "M/D/YYY"), "") & IF(D2<>"", " Date 4 - " & TEXT(D2, "M/D/YYY"), "")), " Date", ", Date")

    It's only 4 IF statements and none of them are nested.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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