If you want to embed a YouTube video on your website, YouTube will create some IFRAME code for you. If you want to embed content from somewhere else, you might have to create your own IFRAME code, or find a free generator somewhere in the interwebs. Or, you can download my sample file, and create IFRAME code in Excel.
Find Sample IFRAME Code
To create the code, I copied sample IFRAME code from my latest Excel tutorial on YouTube. That showed me all the variables – such as height and width – that I’d need to enter, to create my own version.
Enter the Variables
In an Excel file, I set up a worksheet with cells where you enter the variables. You’d have to change the video ID and name for each IFRAME , but could probably leave all the other settings the same:
Combine the Code Strings
In a cell below the variable entry section, I created an IFRAME formula that combines all the variables with the rest of the code. The formula looks complicated, but it’s just combining a bunch of things:
- It uses the & operator, to combine text strings
- The CHAR function uses 34 as its argument, to create double quote marks
- The IF formulas return a variable based on Yes or No selections
Use the IFRAME Code
Here’s the result, when I copy the IFRAME/HTML code, and paste it into the HTML source code for this article.
- The iframe code shows the video
- Below that, the HTML code shows a text link.
This video won’t show you how to build an iframe, but it will show you the new SHEET and SHEETS functions!
Download the Sample File
To download the sample file, please visit my Contextures website. Go to the Sample Files page, and in the Functions section, look for FN0034 – Create IFRAME Code in Excel.
The zipped file is in xlsx format, and does not contain any macros.