+ Reply to Thread
Results 1 to 29 of 29

Concatenate and ignore blanks

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Concatenate and ignore blanks

    Hi Guys,

    I'd like to concatenate two columns but ignore blanks.

    I've attached the file that I'm working with.

    I'd the format to be as shown in the sheet.

    This is the code i've got in a module at the mo:

    Please Login or Register  to view this content.
    I've got a cell with "=MILESTONEDATE(D9:D23,E9:E23,", ")

    But nothing seems to happen.

    Any ideas?
    Attached Files Attached Files
    Last edited by NBVC; 09-24-2009 at 02:30 PM.

  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 and ignore blanks

    Try using this tried and tested UDF:

    Please Login or Register  to view this content.
    and formula

    Please Login or Register  to view this content.
    confirmed with CTRL+SHIFT+ENTER not just ENTER
    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 Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Concatenate and ignore blanks

    The problem with your function is you use a object that has not been defined, rngNames.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    Thanks guys,

    How would I then get each bit to go on a new line using the CHAR(10) thing?

  5. #5
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    also NBVC,

    your formula worked tho it cut off the "/09)" off the last date for some reason

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Concatenate and ignore blanks

    Please Login or Register  to view this content.

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

    Re: Concatenate and ignore blanks

    Using my method:

    Please Login or Register  to view this content.
    Note: It did not cut it for me... maybe your column width makes it appear to be cut...

    Make sure you format Alignment of cell to Wrap text for above formula to work...

  8. #8
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    thanks andy i misread yours

    thanks nbvc - think this way is simpler! :D

    cheers all

  9. #9
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    hey guys,

    sorry to be a pain but VBA is really not my thing but i gotta get this done today!

    I've got this other sheet where I need to now concatenate 3 columns in the same way though the format would be
    Name1 (Position1) - 1 days, Name2 (Position 2) - 2 days etc.

    The columns I need to concatenate are D, E and G

    Any ideas?

    have attached the other file

    thanks and sorry for being dumb!
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    p.s. column E is a lookup

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

    Re: Concatenate and ignore blanks

    Which method? Mine or Andy's?

  12. #12
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    either nbvc
    i checked ur method and it still kept cutting even though i had wrap text checked...
    i just hope it works :D

  13. #13
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    actually would be good to use urs nbvc
    at least i'd learn then!

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

    Re: Concatenate and ignore blanks

    This formula:

    Please Login or Register  to view this content.
    returns:

    James Head of Finance 1,
    Tim Senior Manager 2,
    Joan Accounting Officer 5,
    Patrick Finance Assistant 1,
    Susan Manager 1,
    Nick Senior Manager 3

  15. #15
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    that looks good but when i entered that formula into a cell and confirm with CTRL+SHIFT+ENTER it just says #Name.

    Am I supposed to have some code put in a module?

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

    Re: Concatenate and ignore blanks

    Sorry, try it again... I was using MCONCAT for testing which is an addin function that works just like Aconcat... so I didn't have to use the udf... I changed it, but you must have copied it before I changed it...

  17. #17
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    so i put in the code that you posted before into the module and then put in the formula u supplied into the cell and the ctrl shift and enter?

  18. #18
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    cool it worked!

    thanks! will have a play round to get the format i want

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

    Re: Concatenate and ignore blanks

    yes, that is right.

  20. #20
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    hey just checked again and for some reason it's still cutting the end of the strings?

    for example in this one it just says

    Nick Senior

    as opposed
    to

    Nick Senior Manager 3

  21. #21
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    figured it out...
    the last number at the end should have been a *1 instead of *2

    thanks again

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

    Re: Concatenate and ignore blanks

    Strange that it doesn't for me...
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    sorry one last thing...
    it is definitely still cutting things off.

    is this just a limit of characters allowed in the cell?

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

    Re: Concatenate and ignore blanks

    Well it looks like max chars I can get into the cell with that formula is 1739.. is yours more?

  25. #25
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    hey it's that number on the end that is messing things up...

    if i do "/3" i get more characters.

    is there no way for it just to take everything?

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

    Re: Concatenate and ignore blanks

    Try this one instead:

    Please Login or Register  to view this content.

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

    Re: Concatenate and ignore blanks

    Forgot the commas...

    Please Login or Register  to view this content.

  28. #28
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    cool that's much better...
    that allows 13 names at least...
    if they want more than i'll just tell them it's not possible

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

    Re: Concatenate and ignore blanks

    Don't forget to please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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