Reputation: 1812
I have a cell that might contain a single value
e.g. "images/dog.jpg"
or might contain multiple values, separated by a comma delimiter
e.g. "images/dog.jpg,images/cat.jpg,images/pig.jpg"
If it just contains the single element, the formula is pretty straightforward. If it contains multiple values, I should iterate through those values and do something with each value.
Here's an example of what I've got so far (given the cell is B2)
=IF(NOT(ISNUMBER(FIND(",";B2))); "<img src=""" & B2 & """>"; FOREACH(SPLITBYDELIMITER(",";B2); "<img src=""" & B2 & """>"))
Where the FOREACH (iteration) and SPLITBYDELIMITER should become correct formulas. I don't know if (and how) this is possible however without using multiple columns.
Thanks!
Upvotes: 2
Views: 1231
Reputation:
You might be going at this the wrong way. By simply altering the comma delimiter into appropriate bolerplate text you should acheive the desired result.
="<img src="&CHAR(34)&SUBSTITUTE(A3, ",", CHAR(34)&">,<img src="&CHAR(34))&CHAR(34)&">"
Upvotes: 4