Quote:
Originally Posted by JAlvarez
Hi,
In excel I have a list of invoice numbers, one on each cells (multiple rows)
43333,
43332,
12323,
78922,
I need a formula that will put all those in a single line/cell and with a single quote in between, so like this:
'43333','43332','12323','78922',
Any help would be appreciated. Thanks!
|
Hi There,
Not sure if there is any excel built in function that can do this for you (Again as per my knowledge!). Here is a small VBA function that may help you.
Public Function ConCat(Rng As Range, EncloseWith As String, ParseWith As String)
Dim cell As Range
Dim Temp As String
For Each cell In Rng.Cells
Temp = Temp & EncloseWith & cell & EncloseWith & ParseWith
Next cell
ConCat = Temp
End Function
The arguments are as following
Rng - select the range which will be concatenated
EncloseWith - A string which will enclose each cell value. ' in your example.
ParseWith - A string that will separate each entry. , in your example.
While using the function just keep numbers in each cell (without commas).
Another small correction that you will have to make is to remove the last comma which may not be required.
I understand this isn't the best solution but might be useful if you haven't been able to find a better one.
Let me know if this helps.
Thanks,
Prashant