Excel Image Lookup: Show a Picture Based on a Cell Value

A common request: pick a product code from a drop-down and see its picture, or show the right photo next to each row of a list. Lookup functions such as XLOOKUP and INDEX-MATCH are great at finding text and numbers, but a picture sitting on top of the grid is not a cell value, so a plain lookup cannot return it. Excel can still do image lookups, as long as you choose the right technique for your situation. Here is what works, and where each approach stops.

First, decide what you actually need

  • One picture that changes when you select a different value (a viewer or a form): use the linked-picture technique, or IMAGE() with a lookup.
  • A picture beside every row of a list, permanently: use IMAGE() if your pictures are online, or insert the pictures by file name (see the last section).

Technique 1: IMAGE() with a URL built from the cell value

If your pictures are hosted online and their addresses follow a pattern, you can build the address from the cell value. With a product code in A2:

=IMAGE("https://example.com/images/" & A2 & ".jpg", A2, 0)

If the addresses are stored in a table instead, look the address up first:

=IMAGE(XLOOKUP(A2, Products[Code], Products[ImageURL]), A2, 0)
=IMAGE(INDEX(Products[ImageURL], MATCH(A2, Products[Code], 0)), A2, 0)

Things to know:

  • IMAGE() is a Microsoft 365 function, and XLOOKUP needs Excel 2021 or Microsoft 365. INDEX-MATCH works in older versions of Excel, but IMAGE() itself does not.
  • The address must start with https://. IMAGE() cannot read a file on your computer, and Microsoft documents that it does not support images stored on OneDrive or SharePoint, or behind a sign-in.
  • The picture sits in the cell and moves with it, and the file size stays small because only the address is stored.

If your pictures are on your own drive, read our IMAGE() function alternative.

Technique 2: The linked-picture lookup (Windows)

This long-standing trick shows one picture that changes with a selection. It works with pictures you have already inserted into the workbook.

  1. On a helper sheet, put the names in column A and insert each picture next to its name, sized to fit its cell. Set each picture to Move and size with cells.
  2. On your main sheet, create a cell for the selection (a drop-down list built with Data Validation works well).
  3. Define a named range, for example PicLookup, with a formula that returns the cell next to the matching name:
    =INDEX(Helper!$B$2:$B$50, MATCH(Main!$B$1, Helper!$A$2:$A$50, 0))

    Use Formulas > Name Manager > New and paste the formula into Refers to.

  4. Copy any helper cell that contains a picture, then on the main sheet use Paste > Linked Picture. (You can also add the Camera command to the Quick Access Toolbar.)
  5. Click the new picture, and in the formula bar replace the cell reference with =PicLookup. Press Enter.

Now the picture follows your selection. The limits: all pictures must be inside the workbook, which can make it large, so resize them first; it takes setup for every item; and the Camera and Linked Picture features are mainly a Windows tool, so check what your Mac version offers.

Technique 3: Pictures placed in cells

In current Microsoft 365 builds, Insert > Pictures > Place in Cell stores a picture as the content of a cell. Because the picture is cell content, lookup formulas that reference that cell can usually display it, and it follows sorting and filtering. This feature is rolling out in stages, so test it in your own build before you design a workbook around it.

When an add-in is the better tool

Lookups answer the question “show me the picture for this value.” Often the real task is “put the right picture beside every value in this list.” When the pictures are files in a folder on your computer, named after your values, an add-in is faster than building a lookup for each item.

autoIMAGE matches image file names to cell values and inserts the pictures into the cells (or into cell comments). You can preview the matches before inserting, pictures keep their aspect ratio, and they stay with their rows when you filter. To be clear about the difference: the pictures it inserts are static; it is not a drop-down viewer that swaps one picture for another. It runs on Windows and Mac, and it works with local files.

Goal Best fit
One picture that changes with a drop-down Linked-picture lookup (Windows), or IMAGE() with XLOOKUP
Hosted pictures for each row IMAGE() with a built or looked-up https address
Local pictures beside each value, hundreds of rows Add-in such as autoIMAGE

See your pictures matched to your list

Test autoIMAGE for 30 days on your own data (up to 20 images per run on the free plan), or choose the Lifetime Plan: $69 once, no subscription, all future updates.

Try Free, No Credit Card NeededGet the Lifetime Plan

Related reading: how to insert images into Excel based on cell value, and our complete guide to inserting images in Excel.

Skip the manual work with autoIMAGE

autoIMAGE matches your image file names to your cell values and inserts the pictures for you. Works on Windows and Mac. Free for 30 days, up to 20 images per run.

Try FreeBuy Lifetime – $69

Back to all Excel Tips