tags:

views:

57

answers:

3

How do I use more than 255 characters in Excel's CONCATENATE function? I am actually also using the CONCATENATE function within the HYPERLINK function in EXCEL. An example looks like this:

=HYPERLINK(CONCATENATE("http://www.google/com/morethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255chars","morethan255chars morethan255charsmorethan255charsmorethan255charsmorethan25"),"link");

UPDATE: It's not issue with CONCATENATE function, but an issue with the first parameter of the HYPERLINK function. Using a string longer than 255 characters directly/indirectly (ex: =HYPERLINK(K204,"link") where K204 contains the 256-character length link) fails the HYPERLINK function

I realize that I can use a URL shortener, but I am doing this for ALOT of links which would require ALOT of manual use of the URL shortener.

A: 

Instead of writing

=CONCATENATE("Toto";"Tata")

Put Toto in cell Z1 (for exemple) and Tata in cell Z2 and write

=CONCATENATE(Z1;Z2)
GôTô
Shortest and least clear answer on SO, ever.
kaloyan
Instead of using strings in the concatenate function, put the strings in cells and concatenate the cells.
GôTô
@GôTô: you might want to update your answer to include this point, and maybe include a simple example if posible.
FrustratedWithFormsDesigner
Yea, I tried that (putting the 256-character length URL in Z1). It still fails
syker
Isn't cell size limited to 255 characters? Have you tried splitting it into several cells?
GôTô
@GôTô: No, cell size is limited to ~32,000 chars.
kaloyan
@kaloyan: Ok, thanks
GôTô
+1  A: 

I have Excel 2007 and I tried making a cell with 300 characters in A1, and another with 300 different characters in B1.

Then I made C1 = CONCATENATE(A1, B1).

I can see all of the characters from both cells. Nothing is missing or truncated and no errors were received. It looks good to me.

What makes you think that the concatenate is failing? Are you having trouble seeing your results? If your cell contains more than 1,024 characters only the first 1,024 are displayed in the cell. However they are still there and if you copy and paste them all of the characters will be copied.

Edit: Now that you have editted your question I realize the problem is with HYPERLINK and not CONCATENATE.

The only way to get around the 255 character limit of HYPERLINK formula in Excel is to copy a hyperlink from Word and paste it into a cell in Excel. Then it can be super long. I know this is an unreasonable manual process if you have a lot of links but it seems the only way to get it into an Excel spreadsheet and yet still have it be a hyperlink that you can click on and be redirected. If you don't need it to act like a hyperlink then I would suggest rewriting your queries to return the hyperlink as its own text field and then it will be fine.

hyprsleepy
@hyprsleepy I tried pasting the really long URL into a cell (ex: K2), and then using the formula =HYPERLINK(K2, "link"). This did not work for me, did it work for you?
syker
@syker - Read my edit and you will see that the hyperlink part did not work although the concatenate did. I posted a suggestion for getting around the hyperlink problem but I know it is probably too much work to implement, but at least it does work.
hyprsleepy
+1  A: 

You might be out of luck. It seems that the character limit for hyperlinks in Excel is 256 as pointed out here. If you test it out yourself (I have Excel 2007, too), =HYPERLINK(REPT("a",255)) works and =HYPERLINK(REPT("a",256)) does not and throws a #VALUE! error.

kaloyan
Might Excel have a URL shortener function which creates an in-memory hash of the long URL to the short URL?
syker
Now that's wishful thinking :). If Twitter came up with Excel then maybe. In MS Excel's case, though, you'd have to resort to VBA magic. Or better yet, export your data to CSV, read it and generate the links with a script -- that's what I would do.
kaloyan
Honestly, why would they even put such a limit in the first place?
syker
Because Excel is, and has always been, 99% useful and 1% annoying?
kaloyan