Excel IMAGE function - quick way to insert picture in cell with formula

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.

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

Where:

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. Excel IMAGE function

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.

For example:

=IMAGE("https://cdn.ablebits.com/_img-blog/image-function/items/umbrella.png", "umbrella")

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. Hover over the cell with an IMAGE formula to see the tooltip.

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. Fill the whole cell with an image.

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:

  1. 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.
  2. Upload the product images to some folder on your website.
  3. 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.
  4. Copy the formula across the below cells in the Image column.
  5. 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: A 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.

  1. 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.
  2. 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]
    Define names for the table columns not including the headers.
  3. 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. Create a dropdown list.
  4. 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: Build an XLOOKUP formula to return a matching image.

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:
A dropdown list with related images

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:

  1. 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.

  2. For each IMAGE formula, configure the alt_text argument exactly as you want the alternative text to appear in the drop down list.
  3. In A2, make a drop down list with Source referring to =Images. Make a dropdown list of images.
  4. 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: A drop down list with pictures in Excel.

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!

Practice workbook

Excel IMAGE function - formula examples (.xlsx file)

25 comments

  1. supplier is sending me an excel template which contains pictures in a cell

    The picture can be viewed in web based outlook and web based excel but when I download the file the cell states #unknown!
    How to solve it

  2. Place in cell IMAGE is pretty working with my MS Office LTSC Professional Plus 2024 Preview edition.
    But when I Save it or Save as and then Re-open it my Workbook, UNKNOWN! error appear in the cell when IMAGE was placed.
    Tried many times doing some suggestion in many cases solution the issue raised here in many website forum.

    Any one pretty working solution or this is just a bug with Office Feature?

  3. Great description, thank you! Unfortunately I can't see the "tooltip pane" displayed. Is there another secret to activate this? Thanks, Nils

  4. 1. Unable to export PDF with images. In PDF/Print preview "#UNKNOWN!" text coming instead of actual image.

    I have uploaded your file ("Excel IMAGE function - formula examples") to Onedrive, opened it in browser (O365 web excel) all images are showing in cells but in PDF preview "#UNKNOWN!" text coming instead of actual image.

    Do you have any idea how to get images in PDF.

    1. Hi Vasu,

      PDF images are not supported. The supported formats are: BMP, JPG/JPEG, GIF, TIFF, PNG, ICO, and WEBP (WEBP only in Excel 365 for Windows).

  5. I create user guides in different languages, an it would be great to include relevant language-specific screenshots as referenced in the Excel file.
    Is there a way to use the embedded file identified in an IMAGE cell, including its display dimensions into a Mail-Merged Word document? Its a pain using INSERTIMAGE IF TRUE MERGEFIELD URL etc formula when needing to do this multiple times in a document.

  6. Mike this is somewhat related to your use of images. I am having trouble copying images between two different workbooks worksheets. The original is called oldwb and the target is ThisWorkbook. I can't seem to get it to paste the image at the original location row and column. Some of the images may be part of a merged cell in the oldwb and may be pasted into a merged row/column in ThisWorkbook. Any tips?

  7. I have a photographic archive with over 150,000 digital images in several file formats. Over the years I have used Lotus 123 and then Excel to create catalogues for groups of these images. The images themselves are arranged alphabetically by country and then alphabetically by city or site and then by location within the site. There has never been a single universal catalogue for the entire archive, but only country by country and not all in the same spreadsheet layout. The images are identified by camera generated numbers that repeat after 10,000, so suffixes or prefixes (such as a numerically expressed date) are used to arrive at a unique number. In the spreadsheets that are most completely elaborated there are fields (columns) for things like work date; attribution of artist, architect, patron; view description; "other information" that might explain iconography or other important features of the image; copyright owner (me); and so on. Not all of the spreadsheets are fully elaborated.

    We are in the process of revising the spreadsheets so that they are identical in layout, that is so that the columns with the various types of data are arranged in the same sequence with the same column width for each of the various columns (whose width is variable depending on the type of data contained in the different columns). We are doing this to facilitate the merger of all of the spreadsheets into one universal sheet for the entire archive.

    The ultimate goal is to arrive at a searchable database that could display the images.

    In the past I have been told that Excel can not store image files in cells. The size of the digital image files varies, the earliest digital photographs are relatively small files, current digital image files can be greater than 50 mb. The total archive takes up about 12 terabytes.

    I would like to be able to have all of these images catalogued in an Excel sheet that could link to the images or contain the images for display on demand by query, if possible.

    Is this something that your software can enable?

    Many thanks for your kind reply.

    James B. Kiracofe

  8. Not only can you not use local files, but you can't even upload image local file to your OneDrive and link it from there. I truly don't understand the point of this function.

    1. Can I not even edit my own comment to correct for typos? Oh Microsoft....how are you so far behind...

  9. I am REALLY surprised that Microsoft didn't consider the fact that people may want to add images that are on their computer. Not everyone has a website with https://...

    I create a lot of puzzles and games using Excel and VBA and hat was 99.999% the reason I bought '365.

    Should stayed with 2019...

  10. 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?

    Thanks

  11. 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.

  12. i want to fetch the data in the list option with one item code to all. like

    item code url_number
    1 50
    1 60
    1 70
    2 20
    2 30

    how can i create the list (Data validation ) with the help of item code.

  13. This feature really needs the possibility to insert images from a local drive as well.

    1. 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.

  14. 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

  15. 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.

  16. 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?

    Thank you.

  17. very good

  18. How would you force the image inserted to be a low resolution image to reduce file size?

    1. 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.

      Thanks,
      Shawn

      1. Late to the party @Shawn, but if the website in question allows you to send parameters in the GET query, you can just assemble the query in a formula and IMAGE would retrieve what you want I think.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)