DivorceHorror
DivorceHorror

Reputation: 11

Adding a function to display an image based on a URL that changes based on a cell in Sheets

Hopefully the title isn't confusing.

I'm making a spreadsheet and I want column B to look at the corresponding cell in column A and change the image URL based on that.

For example, something like

=IMAGE("http://www.website.com/pics/"(A2)".png")

It's been throwing an error, probably because it's expecting a full image URL. Is there a good way to do this that I can just copy it to every cell in a column and it'll look at the right cell and display the correct image?

Upvotes: 0

Views: 33

Answers (1)

DivorceHorror
DivorceHorror

Reputation: 11

I ended up opening a second tab on the sheet and putting the first part of the url in a cell

http://www.website.com/pics/

then I put the last part in another cell

.png

then copied the links to those cells and went back to the original tab of the sheet I was working on and made a JOIN command using those links.

=IMAGE(JOIN("",'Your sheet name here'!$B$1,A11,'Your sheet name here'!$B$3))

I had to add the $ in manually so it doesn’t change if you past it elsewhere, change A11 to whatever cell you want to reference.

Upvotes: 1

Related Questions