If you want to include an image in Excel, like a company logo or product photo, you can add the image using the Insert tab. But, to keep the image within a particular cell, use the IMAGE function instead.
With this handy function, you add the URL for the image, optionally include alternative text, and choose how you want the image sized within the cell.
About the IMAGE Function
The syntax for the function is IMAGE(url, alt_text, sizing, height, width) where only the first argument is required. This argument is the URL for the image, which should be placed in quotation marks. Below are descriptions of the four optional arguments:
Alt_text: Include alternative (alt) text to improve accessibility; the text should be placed within quotes. Sizing: Enter one of four sizing options: 0 to fit the image in the cell and maintain the aspect ratio, 1 to fit the image in the cell and ignore the aspect ratio, 2 to maintain the original image size, or 3 to customize the size using the height and width arguments. Height: Use with 3 for the sizing and enter the height in pixels. Width: Use with 3 for the sizing and enter the width in pixels.
You can insert BMP, GIF, ICO, JPG, PNG, TIFF, and WEBP image formats.
Use the IMAGE Function in Excel
Now that you know how to build the formula and understand the supported image file formats, let’s look at some examples using the IMAGE function with the picture below.
In this first example, we’ll insert the image without alt text or optional sizing using this formula:
Here, the image stays within the cell and maintains its aspect ratio as you resize the cell by adjusting the row and column. It’s the same as using 0 for the sizing argument.
Next, we’ll include the alt text “dog” and use the sizing option 1 to keep the image in the cell but ignore the aspect ratio with this formula:
You can see that if we change the size of the cell, the image is skewed per the sizing option.
Now, we’ll use the following formula with the alt text and sizing option 2 to keep the image’s original size:
This is a large image (1,200 by 675 pixels), so it doesn’t fit within the cell at the cell’s current size. However, we wanted to demonstrate maintaining the original image size.
Finally, we’ll remove the alt text leaving empty quotation marks for the argument. And we’ll use a custom size for our image with 3 for the sizing, 280 pixels for the height, and 500 pixels for the width. Here’s the formula:
If we resize the cell, the image maintains its aspect ratio for the dimensions we entered.
Adding an image in Excel was never difficult; however, the introduction of the IMAGE function means you can place a picture within a cell and keep it there in whatever size you want.
For more on images in Excel, check out how to quickly remove all pictures in your sheet or how to get rid of the background in a picture.