Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I have a library of flags online and would like to have a client-foolproof solution for adding flags.

Right now my function looks like this: =image("http://www.website.com/flags/us.png", 3)

But I would like to just write "us" and the let the functions add this before: =image("http://www.website.com/flags/

And this after: .png", 3)

is this even possible?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Yes, you can do it with function CONCATENATE to combine the strings. Assume the word us is in A1, you can add below forumla to B1,

=IMAGE(CONCATENATE("http://www.website.com/flags/",A1,".png"), 3)

You can also use function CONCAT too, but it is less useful as it only accepts two strings as parameters.

share|improve this answer
    
I copied and pasted your function (changing the URL to the correct path), but only get a "error: Not a number:" –  Craig Jonathan Kristensen Jan 22 '13 at 15:25
    
fixed. please use comma instead of plus –  neo Jan 22 '13 at 15:38
    
This works perfectly! Is there a way to apply it to a column so that it is automatically added to the actual cell? S the same cell that I write "us" will be the same cell as the flag appears? –  Craig Jonathan Kristensen Jan 22 '13 at 15:48
    
In my knowledge it is not possible with formula but it is possible with script in the script manager with onEdit. A sample is here, how2guru.com/archives/how-to-google-spreadsheet-trigger –  neo Jan 22 '13 at 15:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.