The IMAGE function inserts images into cells from a source location along with alternative text. You can then move and resize cells, sort and filter, and work with images within an Excel table. Use this function to visually enhance lists of data such as inventories, games, employees, and mathematical concepts.
Syntax
=IMAGE(source, [alt_text], [sizing], [height], [width])
The IMAGE function takes the following arguments:
source The URL path, using an "https" protocol, of the image file. Required. Supported file formats include BMP, JPG/JPEG, GIF, TIFF, PNG, ICO, and also WEBP (WEBP is unsupported on Web and Android).
alt_text Alternative text that describes the image for accessibility. Optional.
sizing Specifies the image dimensions. Optional. There are several possible values:
-
0 Fit the image in the cell and maintain its aspect ratio.
-
1 Fill the cell with the image and ignore its aspect ratio.
-
2 Maintain the original image size, which may exceed the cell boundary.
-
3 Customize the image size by using the height and width arguments.
height The custom height of the image in pixels. Optional.
width The custom width of the image in pixels. Optional.
(if only one of the arguments of height/width is specified, the aspect ratio of the image will be kept according to the provided argument)
Remarks
: You may receive a message that access to some linked data type images is turned off because they require a connection to an external source. If you trust the connection, you can turn on access to the images. For more information, see Block or unblock external content in Office documents.
Be careful customizing the height and width as it may skew the aspect ratio, or the proportional relationship between the original image height and width.
If source is a URL that requires authentication, the image doesn’t render.
If source is a URL that’s redirected, it’s blocked because of security concerns.
To work around the URL limit of 255 characters, avoid copying a long URL from the browser address bar. Instead, right click the image in the browser, select Copy image link, paste the value into a cell in Excel, and then reference that cell as source. For example, if the long URL is copied to F10, create the following function call: =IMAGE(F10).
Accessibility
We recommend using effective alternate text to promote accessibility:
-
Select the cell that contains the IMAGE formula, and then in the formula bar, add the alternative text as the second argument of the formula (alt_text).
-
If the image source is a linked data type or record, add alternative text to the original data source or ask your administrator to add it.
-
If the image is derived from a more complex formula, add alt text to that formula or the source where the image is coming from.
For more information, see Everything you need to know to write effective alt text.
Errors
Excel returns a #VALUE! error under the following circumstances:
-
If the image file is not a supported format.
-
If source or alt_text is not a string.
-
If sizing is not between 0 and 3.
-
If sizing is 3 but height and width are blank or contain values less than 1.
-
If sizing is 0, 1, or 2 and you also provide a width or height.
For more information, see How to correct a #VALUE! error.
If there are issues with your internet connection or the server providing the source, Excel returns a #CONNECT! error. Check the internet connection on your device and try again. For more information, see How to correct a #CONNECT! error.
If your security settings block access to the image file in a cell, Excel returns a #BLOCKED! error. Check the security settings for Linked Data Types. Also, if this occurs with Excel for Web or Excel Mobile, ensure you enable images by using the business bar at the top of the workbook. For more information, see How to correct a #BLOCKED! error.
Examples
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet.
After you paste this example, keep it selected. Set the cell style to Normal (Home > Cell Styles), the row height to 30 (Home > Format > Row Height), and the column width to 16 (Home > Format > Column Width).
Data |
|
https://support.content.office.net/en-us/media/35aecc53-b3c1-4895-8a7d-554716941806.jpg |
Cylinder |
https://support.content.office.net/en-us/media/926439a2-bc79-4b8b-9205-60892650e5d3.jpg |
Pyramid |
Formula |
Results |
=IMAGE("https://support.content.office.net/en-us/media/2d9e717a-0077-438f-8e5e-f85a1305d4ad.jpg", "Sphere") |
|
=IMAGE(A2, B2, 0) |
|
=IMAGE(A3, B3, 1) |
|
After you paste this example, keep it selected. Set the cell style to Normal (Home > Cell Styles), the row height to 57 (Home > Format > Row Height), and the column width to 21 (Home > Format > Column Width).
Data |
|
https://support.content.office.net/en-us/media/926439a2-bc79-4b8b-9205-60892650e5d3.jpg |
Pyramid |
Formula |
Results |
=IMAGE(A2, B2, 3, 100, 200) |
|
See Also
Change the size of a picture, shape, text box, or WordArt
What are linked data types in Excel?
Add alternative text to a shape, picture, chart, SmartArt graphic, or other object