To insert an image in an Excel cell with a formula, use the IMAGE function with a direct image URL, such as =IMAGE(A2,"Product photo",0). Put the URL in A2 and enter the formula in another cell. Excel displays the picture inside that cell; you can then choose how it fits and copy the formula for other image links. You’ll need Microsoft 365 and an image address Excel can access.
What You’ll Need
- Excel for Microsoft 365. This guide is for the Windows desktop version. The IMAGE function is also available in Excel for the web and Microsoft 365 for Mac. Excel 2021 and earlier perpetual editions may not support it; check the version before building a workbook around the function.
- A direct, accessible image URL. Use an HTTPS web address that points to an image file or image resource, not just a webpage containing a picture. The image must be reachable without a sign-in, special browser session, or other credentials Excel cannot provide.
- A place to store the image URLs. A simple layout is URLs in column A and image formulas in column B, with headers in row 1. Keeping the links separate makes it easier to replace, check, and reuse them.
Step-by-Step
- Find and check the image URL. Copy the address for the image itself from its source. If you only have a page address, open the image in a browser or use the site’s image-copy option to find its direct URL. Paste the link into a browser tab first. It should open or display the image without asking you to log in. A URL that ends in .jpg or .png is common, but a file extension alone does not guarantee that the link is accessible or in a supported format. Some image services use a URL without an obvious extension.
- Set up the worksheet. In a blank workbook, type a heading such as Image URL in A1 and Image in B1. Paste your first image link in A2. Keep the link as text; do not add extra quotation marks around it in the cell. For a list, put one URL on each row, such as A2, A3, and A4. Give each row enough height later to show the picture clearly.
- Enter the IMAGE formula. With the URL in A2 and the image intended to appear in B2, select B2 and enter
=IMAGE(A2,"Product photo",0). Press Enter. The first argument tells Excel where to find the image, the second supplies alternative text for accessibility, and 0 tells Excel to fit the picture inside the cell while keeping its proportions. If your URL is in a different cell, change A2 to that cell reference. - Make the cell large enough to see the result. A picture can look tiny if its row or column is small. Drag the boundary between column headings B and C to widen column B, and drag the boundary between row numbers 2 and 3 to increase row 2’s height. You can also use Home > Format to set a specific column width or row height. The image remains associated with B2, so changing the cell dimensions changes the available display area.
- Choose a sizing mode that suits the image. The third argument controls the display. With the URL in A2 and the picture in B2, the formula
=IMAGE(A2,"Product photo",1)stretches the image to fill the cell; this can change its proportions. The formula=IMAGE(A2,"Product photo",2)displays it at its original size, which may be larger than the cell. Mode 0 is usually the best starting point because it fits the picture inside the cell without distorting it. If you use mode 1, consider whether the stretched appearance is acceptable for the kind of image you have. - Use custom dimensions if you need consistent sizes. The fourth and fifth arguments set image height and width in pixels when the sizing argument is 3. With the URL in A2 and the picture in B2,
=IMAGE(A2,"Product photo",3,120,160)requests a height of 120 pixels and width of 160 pixels. Adjust the row height and column width to give the image room. If the requested dimensions do not fit the cell, increase the cell dimensions rather than assuming the formula has failed. - Fill the formula down for a list of images. With URLs in A2:A20 and the first image formula in B2, copy B2 down the column using the fill handle at the lower-right corner of the selected cell, or copy and paste it into the remaining rows. Excel adjusts the relative reference from A2 to A3, A4, and so on. Check a few results, especially if some links come from different websites or use different image types. You can also double-click the fill handle when there is adjacent data to indicate how far to fill.
- Save and check how the workbook will be used. Save the file as an Excel workbook (.xlsx) and reopen it if the images are important to a report or shared file. IMAGE retrieves pictures from their URLs rather than embedding each original image as a regular floating picture, so access to the source matters. If you send the workbook to someone else, confirm that the recipient’s Excel version supports IMAGE and that their environment can reach the image addresses.
Common Mistakes
Using a webpage URL instead of an image URL. A link to a product page or social post may show an image in a browser but still not be a usable image source for IMAGE. The function needs an address Excel can retrieve as an image, not a page that requires browser code to locate or display the picture. Test the address directly, and look for a download or copy-image-address option on the source site.
Assuming the formula stores the picture in the workbook. The formula points to an external image location. If the source is removed, moved, restricted, or unavailable, the picture may stop displaying. Keep the source files at stable addresses and retain a separate record of the URLs. If you need a workbook that contains its pictures independently of a website, use Excel’s picture-insertion feature instead of relying on IMAGE.
Expecting an image to float over cells. IMAGE returns a picture in a cell. It is not the same as inserting a picture that can be freely dragged over the worksheet grid. If your design needs a logo positioned across several cells, a manually inserted picture may be more suitable. For a sortable catalog or table where each picture belongs to a row, the in-cell result is often more convenient.
Using a sizing mode that crops or distorts the picture. Mode 1 fills the available cell area and may stretch the image. Mode 2 uses original dimensions and can extend beyond the visible cell area. Mode 0 fits the image while preserving its proportions, although that can leave unused space around it. Pick a mode based on whether preserving the complete image or filling the cell matters more.
Forgetting accessibility text or workbook compatibility. The optional alt-text argument gives screen readers a description of the picture; it is not a caption that appears on the sheet. Also, a recipient using an older Excel release without IMAGE may see an unsupported-function error rather than the picture. Check the target version before distributing a workbook that depends on this function.
Tips
- Use meaningful alt text. Replace “Product photo” with a brief description that identifies what matters, such as “Blue ceramic travel mug.” Avoid putting a long paragraph in the alt-text argument. For decorative images that communicate no useful information, choose an appropriate concise description based on how the workbook will be used.
- Keep a clean source column. Store URLs in one column and IMAGE formulas in another, with headers and consistent row alignment. This makes it easier to sort the records, spot missing addresses, and replace a link without editing every formula. If you turn the data into an Excel table, keep the URL and image fields clearly labelled.
- Standardize the display area. Set consistent row heights and column widths for a catalog. A consistent grid makes the worksheet easier to scan, even when source images have different shapes. Mode 0 preserves the whole image, so portrait and landscape pictures may have different amounts of empty space inside the same-sized cells.
- Keep links stable and secure. Prefer image addresses from a site or storage service that will keep the files available. An HTTPS address is a good starting point, but it does not guarantee that Excel can access the image. Links that expire, require a private login, or depend on temporary sharing permissions can fail later.
- Use formula references to make maintenance easier. Referencing a URL cell means you can replace the link without rewriting the IMAGE formula. If the picture belongs to a record, keep its URL on the same row as the record so sorting the list does not separate the link from its item.
Troubleshooting
The cell shows #NAME? Excel may not recognize IMAGE because the installed version does not support it, or because the workbook is opened in an older application. Update to a supported Microsoft 365 version or use a manually inserted picture. If the workbook is shared with other people, ask them to check their Excel version too.
The cell shows #BLOCKED! or the image is blocked. Excel or your organization’s security settings may prevent the external image from loading. Check with your Microsoft 365 administrator if this is a work or school device, and use a source that your organization permits. Do not weaken security settings just to display an image from an untrusted site.
The cell shows #CONNECT! or stays blank. Check that the device is online and the URL still works in a browser. Make sure the address is an image resource and does not require a sign-in, a temporary token, or browser-only access. If the link redirects through a login or sharing page, obtain a stable direct image link from the owner or service. Re-entering a valid URL in the source cell can also help if it was pasted with spaces or other unwanted characters.
The picture appears too small, too large, or clipped. First inspect the row height and column width. Then check the sizing argument in the formula: 0 fits the complete image inside the cell, 1 fills the cell but can distort it, 2 uses original size, and 3 uses the specified pixel dimensions. Increase the cell size or choose another mode to get the intended result.
The formula displays as text instead of showing an image. Confirm that the cell is not formatted as Text. Change the cell format to General, select the cell, press F2, and then press Enter to make Excel evaluate the entry again. Also check that the formula begins with an equals sign and that there is no apostrophe before it. On Mac, use Control+U to edit the cell contents if needed, then press Return; ribbon commands may be easier to use if your keyboard settings differ.
The formula works on your computer but not for a colleague. Check both the colleague’s Excel version and their access to the image host. A formula-based image is not a guarantee that everyone can retrieve the source. For a fixed presentation that must look the same offline or in older Excel, consider inserting the picture directly and testing the saved file in the environment where it will be viewed.
Frequently Asked Questions
Can I insert an image in Excel using a formula?
Yes. In Microsoft 365, IMAGE can display an image from an accessible URL in a worksheet cell. Enter the URL in a cell, then refer to that cell in the IMAGE formula.
Does IMAGE work with a local file path on my computer?
IMAGE is designed to retrieve images from a URL, not to embed a picture from a local file path. For a local image, use Insert > Pictures and choose the file. If you need a formula-based image, use an accessible web image URL.
Can I use a link to Google Drive, OneDrive, or another sharing service?
Possibly, but a normal sharing-page link may not be a direct image address, and access permissions can prevent Excel from retrieving it. Use a link that the service makes available for direct image access, test it while signed out if appropriate, and confirm that sharing settings permit the intended viewers.
Will the image still appear if I delete the URL cell?
No. The IMAGE formula needs its source argument. If the formula refers to a URL cell and you delete that cell’s contents, Excel no longer has the address to retrieve. Keep the source link, or use a different method if the workbook must contain a self-contained picture.
Can I sort or filter a list that uses IMAGE formulas?
Yes, as long as each URL, formula, and related record stays on the same row. Put the fields in a table or keep the data together before sorting and filtering. After sorting, check that each displayed image still corresponds to the correct record.
Can I use IMAGE in Excel for the web or on a Mac?
IMAGE is available in Excel for the web and Microsoft 365 for Mac, though menus and some interactions can differ from Windows. On the web or Mac, enter the formula in a cell as usual and adjust the row and column dimensions using the available sheet controls. If the function is missing, check the version and update status.
Related
- Hide Cells in Excel: Shortcut Keys for Rows and Columns
- How to Group Rows in Excel With Plus Signs at the Top
- Excel Group and Ungroup Shortcuts for Rows and Columns
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- How to Add a Filter to a Column in ExcelTo add a filter in Excel for Microsoft 365 on Windows, click a cell in your data, choose…
- Formula for Overtime Hours in Excel: Simple ExamplesFor a daily overtime calculation in Excel, use =MAX(0,(MOD(C2-B2,1)-D2)*24-E2). With a start time in B2, end time in…
- Excel LAMBDA in Name Manager: How to Create and Use ItYes. In Microsoft 365 Excel for Windows, you can save a LAMBDA formula as a defined name in…
- Excel Formula for Weekend vs. Weekday DatesIn Excel, use WEEKDAY to tell a weekend from a weekday: if the date is in A2, =WEEKDAY(A2,2)>5…
- Excel LET Function: Benefits, Examples, and LimitsExcel’s LET function lets you give names to values and calculations inside a formula, making complex formulas easier…
- Excel LAMBDA Use Cases: Practical Examples and LimitsExcel’s LAMBDA function lets you turn a calculation into a reusable custom function, so you can give a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.