Insert images into cells with Excel's IMAGE function

Опубликовано: 12 Октябрь 2024
на канале: Global Excel Summit
1,689
18

Until recently, images were largely a decorative feature of worksheets, which sat on cells rather than in them.

Although there were clunky workarounds, none of them satisfied us.

The IMAGE function changed all that.

It gives us an easy way to reference web images inside the likes of XLOOKUP, FILTER and SORT.

𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻 𝗦𝘆𝗻𝘁𝗮𝘅

=𝙸𝙼𝙰𝙶𝙴(𝚜𝚘𝚞𝚛𝚌𝚎, [𝚊𝚕𝚝_𝚝𝚎𝚡𝚝], [𝚜𝚒𝚣𝚒𝚗𝚐], [𝚑𝚎𝚒𝚐𝚑𝚝], [𝚠𝚒𝚍𝚝𝚑])

➤ 𝚜𝚘𝚞𝚛𝚌𝚎 — URL of the image.
➤ [𝚊𝚕𝚝_𝚝𝚎𝚡𝚝] — alternative text that describes the image.
➤ [𝚜𝚒𝚣𝚒𝚗𝚐] — specifies the image dimensions. It has four possible values:

• 0 — fit the image in the cell and maintain its aspect ratio. (Default)
• 1 — fill the cell with the image and maintain its aspect ratio.
• 2 — display the image at its original size.
• 3 — use a custom size based on the 𝚑𝚎𝚒𝚐𝚑𝚝 and/or 𝚠𝚒𝚍𝚝𝚑 values.

➤ [𝚑𝚎𝚒𝚐𝚑𝚝] — the custom height of the image.
➤ [𝚠𝚒𝚍𝚝𝚑] — the custom width of the image.

𝘖𝘱𝘵𝘪𝘰𝘯𝘢𝘭 𝘢𝘳𝘨𝘶𝘮𝘦𝘯𝘵𝘴 𝘢𝘳𝘦 𝘥𝘦𝘯𝘰𝘵𝘦𝘥 𝘪𝘯 𝘴𝘲𝘶𝘢𝘳𝘦 𝘣𝘳𝘢𝘤𝘬𝘦𝘵𝘴.

In the video example, we retrieve the flag of Finland using this formula:

=𝙸𝙼𝙰𝙶𝙴("𝚑𝚝𝚝𝚙𝚜://𝚠𝚠𝚠.𝚌𝚘𝚞𝚗𝚝𝚛𝚢𝚏𝚕𝚊𝚐𝚜.𝚌𝚘𝚖/𝚠𝚙-𝚌𝚘𝚗𝚝𝚎𝚗𝚝/𝚞𝚙𝚕𝚘𝚊𝚍𝚜/𝚏𝚒𝚗𝚕𝚊𝚗𝚍-𝚏𝚕𝚊𝚐-𝚙𝚗𝚐-𝚕𝚊𝚛𝚐𝚎.𝚙𝚗𝚐").

We can also retrieve many flags at once as the URLs have a pattern.

CONCAT concatenates the repeating parts of the URL with the country name in between. Wrapping this inside LOWER ensures the URL is in lowercase, which is necessary to avoid an error:

=𝙸𝙼𝙰𝙶𝙴(
𝙻𝙾𝚆𝙴𝚁(
𝙲𝙾𝙽𝙲𝙰𝚃("𝚑𝚝𝚝𝚙𝚜://𝚠𝚠𝚠.𝚌𝚘𝚞𝚗𝚝𝚛𝚢𝚏𝚕𝚊𝚐𝚜.𝚌𝚘𝚖/𝚠𝚙-𝚌𝚘𝚗𝚝𝚎𝚗𝚝/𝚞𝚙𝚕𝚘𝚊𝚍𝚜/",
[@𝙲𝚘𝚞𝚗𝚝𝚛𝚢],
"-𝚏𝚕𝚊𝚐-𝚙𝚗𝚐-𝚕𝚊𝚛𝚐𝚎.𝚙𝚗𝚐")
)
)

#exceleration #excel #microsoftexcel #excelformulas #exceltips #globalexcelsummit

---

The Global Excel Summit is the world's largest virtual gathering of Microsoft Excel users and experts.

Learn more at https://globalexcelsummit.com/.

Find us on:

👔 LinkedIn:   / global-excel-summit  
🐤 Twitter:   / excelsummit  
🟦 Facebook:   / globalexcelsummit  
📸 Instagram:   / globalexcelsummit  
🤳 TikTok:   / globalexcelsummit