Learn a new amazingly simple way to insert a picture into a cell by using the IMAGE function.
Microsoft Excel users have inserted pictures into worksheets for years, but that required quite a lot of effort and patience. Now, that's finally over with. With the newly introduced IMAGE function, you can insert a picture in a cell with a simple formula, place images within Excel tables, move, copy, resize, sort and filter cells with pictures just like normal cells. Instead of floating on top of a spreadsheet, your images are now its integral part.
Excel IMAGE function
The IMAGE function in Excel is designed to insert pictures into cells from a URL. The following file formats are supported: BMP, JPG/JPEG, GIF, TIFF, PNG, ICO, and WEBP.
The function takes a total of 5 arguments, of which only the first one is required.
Source (required) - the URL path to the image file that uses the "https" protocol. Can be supplied in the form of a text string enclosed in double quotes or as a reference to the cell containing the URL.
Alt_text (optional) - the alternative text describing the picture.
Sizing (optional) - defines the image dimensions. Can be one of these values:
- 0 (default) - fit the picture in the cell maintaining its aspect ratio.
- 1 - fill the cell with the image ignoring its aspect ratio.
- 2 - keep the original image size, even if it goes beyond the cell boundary.
- 3 - set the image's height and width.
Height (optional) - the image height in pixels.
Width (optional) - the image width in pixels.
IMAGE function availability
IMAGE is a new function, which is currently available only to Microsoft 365 users for Windows, Mac and Android as well as in Excel for the web.
Basic IMAGE formula in Excel
To create an IMAGE formula in its simplest form, it is sufficient to supply only the 1st argument that specifies the URL to the image file. Please remember that only HTTPS addresses are allowed and not HTTP. A supplied URL should be enclosed in double quotes just like a regular text string. Optionally, in the 2nd argument, you can define an alternative text describing the image.
Omitting or setting the 3rd argument to 0 forces the image to fit into the cell, maintaining the width to height ratio. The image will adjust automatically when the cell is resized:
When you hover over the cell with an IMAGE formula, the tooltip pops out. The minimum size of the tooltip pane is preset. To make it bigger, drag the lower-right corner of the pane like shown below.
To fill the whole cell with an image, set the 3rd argument to 1. For example:
=IMAGE("https://cdn.ablebits.com/_img-blog/image-function/items/water.jpg", "ocean", 1)
Normally, this works nicely for abstract arts images that look well with almost any width-to-height ratio.
If you decide to set the image's height and width (4th and 5th argument, respectively), make sure your cell is big enough to accommodate the original size picture. If not, only part of the image will be visible.
Once the picture is inserted, you can get it copied to another cell by simply copying the formula. Or you can reference a cell with an IMAGE formula just like any other cell in your worksheet. For example, to copy a picture from C4 to D4, enter the formula =C4 in D4.
How to insert pictures in Excel cells - formula examples
Introducing the IMAGE function in Excel has "unlocked" many new scenarios that were previously impossible or highly complicated. Below you will find a couple of such examples.
How to make a product list with pictures in Excel
With the IMAGE function, creating a product list with pictures in Excel becomes incredibly easy. The steps are:
- Make a new product list in your worksheet. Or import an existing one from an external database as a csv file. Or use a product inventory template available in Excel.
- Upload the product images to some folder on your website.
- Construct the IMAGE formula for the first item and enter it in the topmost cell. In the formula, only the first argument (source) needs to be defined. The second argument (alt_text) is optional.
- Copy the formula across the below cells in the Image column.
- In each IMAGE formula, change the file name and the alternative text if you've supplied it. As all the pictures were uploaded to the same folder, this is the only change that needs to be made.
In this example, the below formula goes to E3:
=IMAGE("https://cdn.ablebits.com/_img-blog/image-function/items/boots.jpg", "Wellington boots")
As a result, we've got the following product list with pictures in Excel:
How to return an image based on another cell value
For this example, we are going to create a drop-down list of items and extract a related image into a neighboring cell. When a new item is selected from the dropdown, the corresponding picture will appear next to it.
- As we aim at a dynamic dropdown that expands automatically when new items are added, our first step is to convert the dataset to an Excel table. The fastest way is by using the Ctrl + T shortcut. Once the table is created, you can give any name you want to it. Ours is named Product_list.
- Create two named ranges for the Item and Image columns, not including the column headers:
- Items referring to =Product_list[ITEM]
- Images referring to =Product_list[IMAGE]
- With the cell for the dropdown selected, navigate to the Data tab > Date Tools group, click Data Validation, and configure the dropdown list based on an Excel name. In our case, =Items is used for Source.
- In the cell designated for an image, enter the following XLOOKUP formula:
=XLOOKUP(A2, Product_list[ITEM], Product_list[IMAGE])
Where A2 (lookup_value) is the dropdown cell.
As we look up in a table, the formula uses structured references such as:
- Lookup_array - Product_list[ITEM] which says to search for the lookup value in the column named ITEM.
- Return_array - Product_list[IMAGE]) which says to return a match from the column named IMAGE.
The result will look something like this:
And here's our dropdown list with related pictures in action - as soon as an item is selected in A2, its image is immediately displayed in B2:
How to make a dropdown with pictures in Excel
In earlier Excel versions, there was no way to add pictures to a drop down list. The IMAGE function has changed this. Now, you can make a dropdown of pictures in 4 quick steps:
- Start with defining the two names for your dataset. In our case, the names are:
- Product_list - the source table (A10:E20 in the screenshot below).
- Images - refers to the IMAGE column in the table, not including the header.
For detailed instructions, please see How to define a name in Excel.
- For each IMAGE formula, configure the alt_text argument exactly as you want the alternative text to appear in the drop down list.
- In A2, make a drop down list with Source referring to =Images.
- Additionally, you can retrieve more information about the selected item with the help of these formulas:
Get the item name:
=XLOOKUP($A$2, Product_list[IMAGE], Product_list[ITEM])
Pull the quantity:
=XLOOKUP($A$2, Product_list[IMAGE], Product_list[QTY])
Extract the cost:
=XLOOKUP($A$2, Product_list[IMAGE], Product_list[COST])
As the source data is in a table, the references use a combination of the table and column names. Learn more about table references.
The resulting drop down with images is shown in the screenshot:
Tip. To enhance the visual appeal of your worksheets, you can add color to your drop-down list.
Excel IMAGE function known issues and limitations
Currently, the IMAGE function is in the beta testing stage, so having a few issues is normal and expected :)
- Only images saved on external "https" websites can be used.
- Pictures saved on OneDrive, SharePoint and local networks are not supported.
- If the website where the image file is stored requires authentication, the image will not render.
- Switching between Windows and Mac platforms may cause issues with image rendering.
- While the GIF file format is supported, it is displayed in a cell as a static image.
That's how you can insert a picture in a cell using the IMAGE function. I thank you for reading and hope to see you on our blog next week!
Excel IMAGE function - formula examples (.xlsx file)
I want to ask why my image show 0 value instead of the picture is it due to the size of the cell it may affect this error?
Is there a way to lock a picture in a cell so I can use it on another page? I have been looking and looking for a tutorial but cannot find one.
i want to fetch the data in the list option with one item code to all. like
item code url_number
how can i create the list (Data validation ) with the help of item code.
To create a dropdown list, I recommend using this instruction: How to create drop down list in Excel: dynamic, editable, searchable.
This feature really needs the possibility to insert images from a local drive as well.
It's extremely annoying that this very feature is lacking. Even worse is the fact that the function doesn't integrate with Microsoft Onedrive at all. As for Microsoft SharePoint, it worked only once for me, then stopped working.
I am making an inventory list, and would like to add a picture of item in the same row as the description. I'm not sure what I am doing wrong, but I cannot figure it out. Any help would be greatly appreciated. Thanks
I would like to use this function in infrastructure asset management which includes photos of assets and their conditions and would like to use these in excel reporting but the website limitation makes it unworkable. Please get it to work on local drives or onedrive as well.
I need to add local images into cells and not https ones. Google Sheets has this feature already integrated and works very well.
Please, could you update this feature and allow to insert local saved images?
How would you force the image inserted to be a low resolution image to reduce file size?
Google sheets allows you to create QR codes from data in adjacent cells using the =image function. Is there a way to do the same thing in Excel? There are QR generators for excel as add-ons, but they (at least the free ones) are not automated.