1

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?

1 Answer 1

2

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.

4
  • I copied and pasted your function (changing the URL to the correct path), but only get a "error: Not a number:" Jan 22, 2013 at 15:25
  • fixed. please use comma instead of plus
    – neo
    Jan 22, 2013 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? Jan 22, 2013 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, 2013 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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