473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Excel - concatenate a range

8,435 Expert 8TB
Is there a simple way in Excel 2003 to concatenate a range of cells, rather than individual cells?

In other words, I want to enter =CONCATENATE(D2:AN2) in a cell, but this produces an error. How can I work around it?
Mar 12 '08 #1
4 26673
Stang02GT
1,208 Expert 1GB
Hey Killer,

I did a quick google search on what you were looking for and found some good articles that explain how to do it... here they are..


Excel Tips

MS Excel

Hope that helps you !
Mar 12 '08 #2
Killer42
8,435 Expert 8TB
Thanks for that. Think I'll go with the user-defined CONCAT function.
Mar 13 '08 #3
Stang02GT
1,208 Expert 1GB
Sure thing. I don't know if those links helped you?! But I figured I would at least try and find something to help ya out.
Mar 13 '08 #4
Killer42
8,435 Expert 8TB
Hahahaha... it's got a bug in it. :D

The user-defined function in that "Excel Tips" returns #VALUE! if you include the optional delimiter, and the cells in the passed range are empty. This is because when doing the concatentation it adds an extra delimiter on the end. There's an extra piece of code to then remove it. But if nothing was concatenated, it tries to remove the last 'n' characters of an empty string, and doesn't work.

Here's a corrected version...
Expand|Select|Wrap|Line Numbers
  1. Function Concat(myRange As Range, Optional myDelimiter As String) As String
  2.   Dim r As Range
  3.   Application.Volatile
  4.   For Each r In myRange
  5.     If Len(r.Text) Then
  6.       Concat = Concat & IIf(Concat <> "", myDelimiter, "") & r.Text
  7.     End If
  8.   Next
  9. End Function
  10.  
By the way, is this like Word where I can move macros to the Normal template so they're always available? Couldn't work it out from the doco.
Mar 13 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
0
by: B | last post by:
Using Access2000, the sample code below is what I have been modifying and working on since the past week and I could not get it to work properly. What I wanted to accomplish: 1) read from a...
10
by: Maik | last post by:
Hello, I've got a problem with access to special ranges. I renamed some cells (for example "C4" in "CUSTOM.GENERAL.VPRIM"). This is necessary, because I have to read out only these cells in...
2
by: Ryan Riddell | last post by:
I wrote an application to pull data from certain ranges of an Excel workbook. The application works great for the first 2 of 4 sections I created. I created the third section of code and the...
12
by: Ed | last post by:
Hi All, I'm looking for an efficient way of dumping a table in a Dataset into an Excel sheet. I'm currently copying data cell by cell and this is rather inefficient for large Datasets. My...
3
by: afirst | last post by:
Hello. I have just started using macros in Excel- I recorded a simple formula-now I need the macro to work on a number of spreadsheets, regardless of the number of cases the spreadsheet contains ...
2
by: bbasberg | last post by:
I have been working hard to clean up my code but I am still wondering why all incoming records go to the "AddNew" part of the IF statement and never to the Edit alternative. I believe that it must be...
1
by: ATSRND | last post by:
I would like to write the code to select a range of worksheets in MS Excel 07, starting with the Activesheet and ending with the last sheet.
0
by: attraankit | last post by:
i am working in asp. my concern is how to read an excel spreadsheet using asp, especially when the range in the excel spreadsheet is unknown. i am designing a user form where the use has to browse...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.