Contextures

Create HTML and IFRAME Code

Use formulas in Excel to create HTML or IFRAME code, then add to a web page or blog post, to show links or embedded videos. Get the free workbook, to see how the formulas work.

HTML Code Template

The first sample file is designed to create product links, if you are an Amazon associate.

NOTE: The rules change occasionally, so check the current Amazon Associates agreement, to be sure that these links are in an acceptable format.

  • In the template, enter the product code and product title
    • NOTE: the Product code (ASIN) cell is formatted as text, to preserve any leading zeros
  • Enter your Amazon affiliate tracking ID, so the link will contain that ID
  • Then copy the link or the HTML code, and paste it into a web page or blog article.

build html for amazon link

Create a Simple URL Link

In the "Copy This Link" cell, a formula combines the first part of the Amazon URL, with the product code (ASIN) and the Tracking ID.

If you copy the code from cell B5, and paste into a blog post, you'll see a simple URL link, as shown below.

The link works correctly, but it doesn't show the product name.

product link in blog post

Create a Product Name Link

In the "Copy This HTML" cell, a more sophisticated link is created. It shows the product name, and has a link to the product's URL.

The formula in that cell refers to the four HTML text cells, coloured grey, located below the Tracking ID cell.

build html for amazon link

The four HTML cells have snippets of text that are required for building the HTML code.

The following formula in cell B7 combines the product title and the link, with those four snippets of HTML code.

=HTML_01 & ProdTitle & HTML_02 & ProdLink
& HTML_03 & ProdTitle & HTML_04

All the cells are named, so it's easier to understand the formula. You can follow the colored references in the screen shot below.

build html for amazon link

Paste Into Page HTML Code

To add that link to a web page:

  • Ccopy the "Copy This HTML" cell
  • Switch to the HTML code view for the web page
  • Paste into the HTML code, in the location where you want the link

To see the link, switch back to the Normal view for the web page.

  • The link shows the product name
  • If you point to the link, the product title appears in a little popup.

For example, here is the link created by the HTML code in the sample formula above

product link shows product name in blog post

IFRAME Code Template

To embed a YouTube video, or other web content, on your website, you can use IFRAME code. In this template, there are 2 data entry sheets -- one for YouTube embed code, and one for other types of IFRAMES.

Fill in the details, such as the Video ID, and video name.

build iframe code

Combine the Code Strings

In a cell below the variable entry section, a formula creates the IFRAME code:

  • 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

iframe code

Use the IFRAME Code

To use the code, copy the IFRAME/HTML code, and paste it into a web page or blog article.

  • The iframe code shows the video
  • Below that, the HTML code shows a text link.

iframe code

Download the Sample Files

  • Amazon Links HTML: Click here -- AmazonLinksMaker.zip -- to download the Amazon Links sample file. The zipped file is in xlsx format, and does not contain macros.
  • IFRAME Code: Click here -- exceliframegenerator.zip -- to download the IFRAME code sample file. The zipped file is in xlsx format, and does not contain any macros.

More Tutorials

SUM Function

VLOOKUP

INDEX and MATCH

Count Functions

INDIRECT

MATCH Video

VLOOKUP Video

Hide VLOOKUP Errors

About Debra

 

Last updated: June 11, 2022 11:17 AM