Excel Formulas for Dynamic Image Lookup Based on Cell Value

📅 Mar 26, 2026 📝 Sarah Miller

Many Excel users struggle to dynamically retrieve images, as standard lookup formulas like XLOOKUP or VLOOKUP frustratingly fail to return visual assets. While traditional text-based data retrieval is straightforward, referencing visual data requires bypassing standard grid logic. Mastering dynamic image lookups elevates your reporting, transforming static spreadsheets into highly interactive dashboards. However, this technique stipulates that images must be formatted as "Place in Cell" rather than floating "Over Cells." This capability is ideal for inventory parts catalogs or employee directories. Below, we outline the exact steps to configure this solution using Named Ranges and the INDEX/MATCH formula.

Excel Formulas for Dynamic Image Lookup Based on Cell Value

Imagine building an interactive product catalog, an dynamic employee directory, or a polished KPI dashboard in Excel. You select a product ID or an employee's name from a drop-down menu, and not only do their details update instantly, but their corresponding photo or product image dynamically updates as well.

Historically, referencing an image based on a lookup value in Excel was a complex task that required clumsy workarounds, VBA macros, or advanced camera tool tricks. Thankfully, Excel has evolved. Depending on your version of Excel, you can now achieve dynamic image lookups using straightforward formulas, modern in-cell image features, or the classic (yet highly effective) Named Range technique.

In this comprehensive guide, we will explore the three best methods to reference an image cell based on a lookup value in Excel, ranging from the newest Microsoft 365 features to legacy workarounds that work on older versions of the software.


Method 1: The Modern Way – In-Cell Images with XLOOKUP (Excel 365 & Excel 2024)

If you are using Microsoft 365 or Excel 2024, Microsoft has introduced a revolutionary feature: In-Cell Images. In older versions of Excel, images always floated on top of the grid (in the drawing layer). Now, images can actually reside inside a specific cell, behaving exactly like text or numbers.

Because the image is treated as standard cell content, you can use your favorite lookup formulas-like XLOOKUP or VLOOKUP-to retrieve them without any special workarounds.

Step-by-Step Implementation:

  1. Insert Images in Cells: Go to the Insert tab, click Pictures, and select Place in Cell. Choose your source (this device, stock images, or online). Insert your images into a dedicated column next to your lookup identifiers (e.g., Product IDs in Column A, Images in Column B).
  2. Ensure Correct Alignment: Make sure each image is neatly contained inside its respective cell. You can adjust the row height and column width to make the images larger and clearer.
  3. Create Your Lookup Interface: In a separate area or sheet, set up your lookup cell. For instance, let cell E2 be the cell where users input or select the lookup value (using Data Validation for a clean drop-down menu).
  4. Write the XLOOKUP Formula: In the cell where you want the dynamic image to appear, enter the following formula:
    =XLOOKUP(E2, A2:A10, B2:B10, "Image Not Found")

How it works: The XLOOKUP function searches for the value in E2 within the range A2:A10. When it finds a match, it returns the corresponding cell content from B2:B10. Because the content of that cell is an embedded image, Excel renders the image directly in the formula cell. If no match is found, it safely displays "Image Not Found".


Method 2: The Legacy Way – Named Ranges & Linked Pictures (Excel 2013, 2016, 2019, 2021)

If you or your team are using an older version of Excel that does not support in-cell images, or if you prefer to work with floating images, you can use the classic Linked Picture combined with a Defined Name (Named Range Formula). This method is incredibly clever because it bypasses Excel's inability to return a floating shape via standard cell formulas.

Step-by-Step Implementation:

Step 1: Set Up Your Source Data Table

Create a clean table of data. For example, Column A contains "Product Name" and Column B contains the actual images. Place each image directly over its corresponding cell in Column B. Crucial step: Ensure the images fit entirely within the borders of their cells. If an image overlaps into another cell, the lookup might return parts of neighboring cells.

Step 2: Create Your Lookup Interface

In a separate sheet or area, create your input cell (e.g., E2 for the product name) and format a target cell where the image will be displayed (e.g., F2).

Step 3: Define a Dynamic Named Formula

Because we cannot write a formula directly inside an image object, we must define a custom formula in Excel's Name Manager that resolves to the exact cell containing the desired image.

  1. Navigate to the Formulas tab on the Ribbon and click on Name Manager.
  2. Click New to open the New Name dialog box.
  3. In the Name field, enter a simple, recognizable name (e.g., GetProductImage).
  4. In the Refers to box, enter an INDEX and MATCH formula:
    =INDEX(Sheet1!$B$2:$B$10, MATCH(Sheet1!$E$2, Sheet1!$A$2:$A$10, 0))
    Note: Replace "Sheet1" with the actual name of your worksheet, and make sure all references are absolute (using $ signs).
  5. Click OK and close the Name Manager.

Step 4: Create and Link the Picture

  1. Go to your source table, click on cell B2 (the cell containing the first image, not the image itself), and press Ctrl + C to copy it.
  2. Go to your lookup destination (e.g., cell F2).
  3. Right-click the cell, go to Paste Special, and choose the Linked Picture icon (it looks like a clipboard with a small chain link, or select "Linked Picture" from the Paste options).
  4. With the newly pasted linked picture selected, look up at the Excel Formula Bar. It will likely show something like =$B$2.
  5. Click into the Formula Bar, delete that reference, and type your defined name:
    =GetProductImage
  6. Press Enter.

Your linked picture will now dynamically update to display the contents of whatever cell is returned by the INDEX and MATCH formula. If you change the value in E2, the named formula updates its reference, and the Linked Picture immediately redraws itself to match the newly referenced cell.


Method 3: The Web API Way – Combining IMAGE and XLOOKUP (Excel 365)

If your business stores product images, employee profile pictures, or assets on a web server, cloud storage (like AWS S3), or an intranet portal, you can bypass storing physical images inside your workbook altogether. Excel 365 features a native IMAGE function that can render web-hosted images dynamically using a URL.

This keeps your Excel file size remarkably small, secure, and easily updatable from an external database.

Formula Syntax:

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

Step-by-Step Implementation:

  1. Create a source table where Column A contains your Lookup Key (e.g., SKU) and Column B contains the direct URL path to the image hosted online (e.g., https://example.com/images/sku101.jpg).
  2. In your lookup destination cell, write a nested formula that first looks up the URL, and then feeds that URL directly into the IMAGE function:
    =IMAGE(XLOOKUP(E2, A2:A10, B2:B10, "https://example.com/placeholder.png"))

How it works: The nested XLOOKUP first finds the correct URL string matching the identifier in cell E2. Once retrieved, the IMAGE function instantly fetches that URL and renders the live graphic directly inside the cell. You can even customize the [sizing] argument to stretch, fit, or maintain the original aspect ratio of the dynamic image.


Troubleshooting & Best Practices

  • Ensure Precise Cell Alignment (Method 2): If you are using the Linked Picture method, make sure your source images fit entirely inside their respective cells. If an image is slightly wider or taller than the cell borders, the linked picture will clip and show fragments of neighboring cells. You can turn on "Snap to Grid" (under Page Layout > Align) to help align your pictures perfectly to cell borders.
  • Handling #N/A Errors: Always wrap your lookup functions in an IFERROR or use the built-in fallback argument of XLOOKUP. This prevents ugly error codes from breaking your visual design when a lookup value is deleted or typed incorrectly.
    =IFERROR(XLOOKUP(E2, A2:A10, B2:B10), "No Image Available")
  • Avoid Merged Cells: When working with lookup ranges containing images, avoid using merged cells in your source table. Merged cells can confuse Excel's indexing engine, causing it to return blank spaces or incorrect cells.
  • Performance Optimization: If you are looking up hundreds of images simultaneously using Method 3 (IMAGE function), keep in mind that Excel has to make real-time web requests to fetch those files. For massive workbooks, local in-cell images (Method 1) generally offer superior offline performance.

Summary of Methods

Method Excel Version Compatibility Image Storage Location Key Advantage
In-Cell XLOOKUP Office 365 / Excel 2024+ Embedded inside the cells Easiest to set up; behaves like normal text/data.
Named Range & Linked Pic Excel 2013, 2016, 2019, 2021 Floating over cells Works on almost all legacy versions of Excel.
IMAGE Function + Lookup Office 365 / Excel Web External Web Server / URL Keeps file sizes tiny; scales beautifully.

By leveraging these techniques, you can transform flat, data-heavy spreadsheets into dynamic, visually engaging applications. Choose the method that best matches your team's Excel version, and bring your datasets to life!

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.