I have a row of 5 cells. I want to show an image above each cell depending on the rank of the cell. So if the rank of the cell equals 1, show a specific image (from a link), if the rank is 2, show a different image, and so on.
Here is what my sheet looks like now:
+-------+------+------+------+------+------+
| Image | | | | | |
+-------+------+------+------+------+------+
| Score | 100 | 300 | 200 | 500 | 400 |
+-------+------+------+------+------+------+
How would I go about achieving this?
Best Answer
=image(vlookup(rank(B2,$B$2:$F$2),images!$A$1:$B$6,2,false))
Enter this in cell B1 and then copy across as many columns as necessary.
This formula combines three nested functions:
rank
- the dataset is an absolute reference; this enables the formula to be copied and retain the reference to the dataset.vlookup()
- takes the rank value and returns the image url from the range. Again, the range is an absolute reference so that it will apply to any rank value.image()
- displays the image url returned by vlookupAssumptions:
List of Image urls (one for each rank value)
Range A1:B6 of sheet="images"
Scores:
List of scores
Range B1:B6