Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Displaying Images based on a Result.

Displaying Images based on a Result

Written by Allen Wyatt (last updated January 1, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


Dave has a large database that he keeps in an Excel workbook. It consists of material samples and uses the VLOOKUP function to generate various forms and reports. Dave wants to include a bitmap image on the form that changes according to one of the variables. For instance, if the form is describing an apple, then Dave wants a picture of an apple to appear; if describing a pear, then a pear should appear; and so on.

This is certainly a challenging task, but it is one that can surprisingly be done without macros. The steps are involved, but not that difficult to perform once you get to it:

  1. On a new worksheet, select a cell (such as cell B4).
  2. Enter the name "apple" into the Name box. This defines the name "apple" to refer to cell B4.
  3. With cell B4 still selected, choose Insert | Picture | From File. Select the picture of the apple and insert it.
  4. Enlarge the width and height of cell B4 so that the picture of the apple is contained entirely within the cell.
  5. Repeat steps 1 through 4 for each of your other pictures, placing each picture in a different cell and naming them according to the contents of the picture. (For the sake of this example, I'll assume that "pear" is cell D4 and "orange" is cell F4.)
  6. On the worksheet that will contain your form, create a formula that will contain the names of the fruit, such as the following formula, which displays "apple," "pear," or "orange," depending on the value in cell G1:
  1. It is important that the formula reference the names exactly as you defined them in step 2 for each fruit's picture. For the sake of this example, I'll assume that you entered this formula in cell A1 of Sheet1.
  2. Choose Name from the Insert menu, then choose Define. Excel displays the Define Name dialog box. (See Figure 1.)
  3. Figure 1. The Define Name dialog box.

  4. Replace the contents of the Names In Workbook box with the word "Picture".
  5. Replace the contents of the Refers To box with the following formula:
  1. Click the OK button. You've now defined the name "Picture" to contain the formula entered in step 9.
  2. On the worksheet that will contain your form, select the cell where you want the dynamic image to appear.
  3. Choose Insert | Picture | From File. Select and insert a picture (it doesn't matter which one).
  4. Make sure the picture you inserted in step 12 is selected.
  5. In the formula bar, enter the formula =Picture. (This is the name you defined in steps 7 through 10.) The picture should change to reflect whatever fruit is named in cell A1.

Now, whenever the fruit name in cell A1 changes (which is, in turn, based on the value in cell G1), the image will change.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3128) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Displaying Images based on a Result.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Enabling Editing Erases Worksheet

If you receive a protected worksheet that you want to edit, how do you proceed if you try to unprotect the worksheet and ...

Discover More

Turning Off Smart Quotes for Specific Styles

Smart quotes can be helpful in making a great-looking document, but at times they can be a real pain. Wouldn't it be ...

Discover More

Counting the Times a Worksheet is Used

Do you need to know how many times a worksheet has been used? Excel doesn't track that information, but you can develop ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Changing the Size of a Graphic

Adding a graphic to a worksheet is easy. Getting that graphic to just the right size may take a little bit of trial and ...

Discover More

Sending Drawing Objects to the Back or Front

Not only can you place drawing objects in your worksheets, but you can organize those objects so some are in front and ...

Discover More

Moving and Copying Graphics Objects

Excel doesn't just work with numbers and text. You can also add graphics objects to your worksheets, and then use Excel's ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is three less than 3?

2021-08-05 11:00:08

Dennis Gardin

I have a calendar that will have an image of a person on there birthday. I have a field that I type the year in, and it automatically increment's the day for the next year. I want to know, is there a way to move the picture to the new date. Right now I have to manually move each individual picture.

2021-05-11 06:41:13

Greg Chen

This was a great tip, exactly what I needed!

The only (very minor) comment was that my Excel didn't have the Insert->Name feature, but the workaround was to search for "Name Manager" in the search box.

2021-03-13 12:58:35

kadr leyn

Thanks for great tutorial.
I too created a template to show pictures based on cell content. It can be useful for users.
By adding simple codes that allow us to show images based on cell content to the Worksheet_SelectionChange procedure, I have obtained a useful template.

Source :

2020-10-22 10:55:11


Is it possible for the picture to be part of a formula, for example, if a cell in the worksheet where I want to display the image is 235, then can i create the formula that has it display the picture associated with 235?

2020-02-09 13:03:30

Carlos Fuente

Yep, this does not work.

Only displays the name of the picture, not the image.

2020-01-12 17:45:21


Update: the function works, but doesn't care about the image, displays only the text value of the cell. Very annoying.

2020-01-12 11:56:48


Did everything to the letter, still doesn't work. Excel gives a #NAME? error. Checked a zillion times, everything is correctly copied.
Other than that I noticed that when I try out using the names in a cell (writing it in) it gives a 0 as a result. It tells me that it
doesn't care if I put a picture in that cell (B4,D4,F4), it just gives a 0 a result, since it thinks it is empty, contains no data.
(I'm using Excel 2003.)

2019-11-05 21:44:32

BE Dankberg

would be great if this worked....unfortunately the picture is not changing.

2019-10-21 00:56:48


I'm currently working on a project that requires me to show a floating table (linked image) when a cell is clicked and disappears when another cell is clicked while showing the table for the new cell. Your tip is amazing btw.

2019-07-31 10:32:08

Kim Hull

Hi Allen,

I hope you're keeping well.

I have read through your guide for "Displaying Images based on a Result" as it is very close to something I'm trying to achieve.
I have a "display area" in a worksheet where I'd like to dynamically show .jpg files dependant on a selection from a filtered list. Unfortunately I can't Insert the pictures into the worksheet as there are just over 1000 images I'm working with and I'm sure that would bring Excel to it's knees.

Would you know if it's possible to import an image from a Document folder outside of Excel, dependant on the selection from a filtered list?

e.g. The user would start typing in a "search box" (dynamic filtered list kind of thing) which would then show a list of results matching the search box entry. The user would click the desired result and this would then display the image associated with it in the "display area".

If this is possible could you point me in the right direction on your site to find the resources to teach me how to do this.

Many thanks in advance.

2019-05-25 13:30:28

James S

This works great! However I find when I do this, for every picture added that is linked to a Name variable my file increases by about 1.5MB. I've made sure it's not just that my original image is large. The file size only grows once the formula is added inside the picture.

Do you experience this? Is there a workaround? I set this up and it's working for about 20 different, but at the cost of a 40MB excel file..

Appreciate the troubleshooting

This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.