#Excel IMAGE function is great, but…

If you are using #Excel365, you have the privilege of many powerful functions. IMAGE is one of them!

This function works like a charm with just one argument required. Think about a simple formula like this:

=IMAGE(A1)

It returns the image of the URL you put in cell A1. By default the size of the image returned fits the size of the cell it resides.

Isn’t it cool?

The syntax is simple:

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

Only the first argument (source) is required. There are optional arguments mainly for more control of how the image will fit into the cell, which is illustrated in the next screenshot:

  1. The simplest form. The image fits the size of the cell, with the aspect ratio of the image preserved.
  2. By inputting 1 in the third argument, the image fills the cell, ignoring the aspect ratio.
  3. By inputting 2 in the third argument, the image’s original size is kept and it may exceed the cell boundary, like the screenshot above.
  4. By inputting 3 in the third argument and the height (in pixel) of the image in the forth argument, the image’s height is specified by your input while the aspect ratio is preserved.
  5. By inputting 3 in the third argument and the width (in pixel) of the image in the fifth argument, the image’s width is specified by your input while the aspect ratio is preserved.
  6. By inputting 3 in the third argument but omitting the forth or the fifth argument, it returns error.

    Of course we can input a specific values to the height and width at the same time. However, this action will normally distort the original aspect ratio of the image and hence not recommended.

You may find more details about this function in MS documentation here, which I highly recommend you do so.

So far, the function seems perfect! The problem is… when we have many different URL images to return in a workbook, file size can be a problem. I tested on a workbook with 5000 images. I did this at work, sorry that can’t share that file. The file size was 12G!!!!! This is out of my expectation because I assume Excel retrieve the image on the fly.

One interesting observation is that, the image coming from the same URL seems not take extra space. You may download a sample workbook here to see. In the sample workbook, I have duplicated the same line to 1000+ rows. The file size increase was insignificant. It went from 365KB to 408KB.

If you know how to compress image size when using IMAGE function, please leave your comments. šŸ™Œ

Unknown's avatar

About MF

An Excel nerd who just transition into a role related to data analytics at current company......😊 Recently in love with Power Query and Power BI.šŸ˜ Keep learning new Excel and Power BI stuffs and be amazed by all the new discoveries.
This entry was posted in Excel 365, Formula and tagged , . Bookmark the permalink.

2 Responses to #Excel IMAGE function is great, but…

  1. Vikas's avatar Vikas says:

    i want to keep only the image, but when I break link, image vanish. How can I keep only image?

    i tried paste special values also, but image vanished next day.

    please share solutions.

    Like

    • MF's avatar MF says:

      You should hide instead of deleting the column that holds the URL. In case you must delete the cells with the URL, you can hardcode the URL in the IMAGE function.

      Like

Leave a reply to MF Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.