Using concatenate function to combine array of numbers

Arundivakar

New Member
Joined
Oct 11, 2018
Messages
4
How can i concatenate an array of numbers say A1:A100? I'm getting error as #value ! When i use =concatenate (A1:A100). As I'm not using a latest version of Office, i cannot use textjoin function.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi,

Try a Vba code ....to use enter CONCATENATERANGE(A1:A100)

Function CONCATENATERANGE(Ref As Range) As String
Dim Cell As Range
Dim Result As String
For Each Cell In Ref
Result = Result & Cell.Value
Next Cell
CONCATENATERANGE = Left(Result, Len(Result) - 1)
End Function
 
Last edited:
Upvote 0
admiral100
The function needs a separator (or change the last line).
 
Upvote 0
Thank's footoo :)

★ Arundivakar just remove the - 1 or try this (with separator)


Function CONCATENATERANGE(Ref As Range, Separator As String) As String
Dim Cell As Range
Dim Result As String
For Each Cell In Ref
Result = Result & Cell.Value & Separator
Next Cell
CONCATENATERANGE = Left(Result, Len(Result) - 1)
End Function
 
Upvote 0
Here's another way :
Code:
Function CONCATENATERANGE(Ref As Range, sep$) As String
CONCATENATERANGE = Join(Application.Transpose(Ref), sep)
End Function
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top