473,385 Members | 1,337 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,385 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 26671
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.