Excel Function: IMAGE

Purpose

The IMAGE function retrieves an image from a location specified by a URL and inserts it into a cell.

Invocations of the IMAGE function take the form:

IMAGE(source,[alt_text],[sizing],[height],[width])

Limitations

Arguments

ArgumentArgument typeDescription
sourceMandatoryRepresents a URL at which an image is accessible. The URL must use the HTTPS protocol.
alt_textOptionalA description of an image, intended for people who are visually impaired.
sizingOptionalDictates how an image should be sized. It can assume one of four values:
ValueDescription
0Make an image as large as possible and maintain its aspect ratio.
1Fit an image to the cell and ignore its aspect ratio.
2Display an image at full size. It may go beyond the boundary of the cell.
3Size an image per the height and width arguments.
heightOptionalAn image’s height in pixels. Mandatory if sizing has a value of 3.
widthOptionalAn image’s width in pixels. Mandatory if sizing has a value of 3.

Related Functions

FunctionExamplePurpose
ENCODEURLIMAGE(ENCODEURL(source))Sanitise a URL, then retrieve & display the image located at it.

Error Conditions

The IMAGE function will respond with an error value if any of the following conditions are met.

Error valueCondition typeCondition
#VALUE!Bad argumentAn attempt was made to get an image with an unsupported format.
#VALUE!Bad argumentAn invalid URL was supplied to the source argument.
#VALUE!Bad argumentThe sizing argument’s value was 3 and height and/or width were omitted.
#VALUE!Bad argumentThe sizing argument’s value was 3 and height and/or width were ≤ 0.
#VALUE!Bad argumentThe sizing argument’s value was 0, 1 or 2 and height and/or width were provided.
#CONNECT!RuntimeIt was not possible to access the image.
#BLOCKED!RuntimeThe image exists but access to it was denied.

Example 1: Sizing Type 0

Formula

=IMAGE("https://img.icons8.com/?size=512&id=12510&format=png","Sizing type: 0",0)

Result

Sizing type 0 made the image as large as the cell permitted whilst preserving the image's aspect ratio.
Sizing type 0 made the image as large as the cell permitted whilst preserving the image’s aspect ratio.

Example 2: Sizing Type 1

Formula

=IMAGE("https://img.icons8.com/?size=512&id=12510&format=png","Sizing type: 1",1)

Result

Sizing type 1 made the image as large as the cell permitted whilst disregarding the image's aspect ratio.
Sizing type 1 made the image as large as the cell permitted whilst disregarding the image’s aspect ratio.

Example 3: Sizing Type 2

Formula

=IMAGE("https://img.icons8.com/?size=512&id=12510&format=png","Sizing type: 2",2)

Result

Sizing type 2 displayed the image at full size.
Sizing type 2 displayed the image at full size.

Example 4: Sizing Type 3

Formula

=IMAGE("https://img.icons8.com/?size=512&id=12510&format=png","Sizing type: 3",3,100,100)

Result

Sizing type 3 displayed the image per the ‘height’ and width arguments supplied to the IMAGE function.
Sizing type 3 displayed the image per the height and width arguments supplied to the IMAGE function.

Example 5: Sorting Images

Columns containing images retrieved by the IMAGE function can be sorted. Excel sorts them by alt_text then by source.

Sorting images A-Z orders them alphabetically, first by 'alt_text' then by 'source'.
Sorting images A-Z orders them alphabetically, first by alt_text then by source.
Sorting images Z-A orders them alphabetically, first by 'alt_text' then by 'source'.
Sorting images Z-A orders them alphabetically, first by alt_text then by source.