About creating a formula that uses data on the same Web page

Office Components Spreadsheet

About creating a formula that uses data on the same Web page

You can return a value in a cell from data that's on the same Web page as your spreadsheet by using the Spreadsheet Component HOST function. For example, if you have a text box control on your page that's named TextBox1, the following formula will retrieve the value from the text box and display it in the cell that contains the formula:

=HOST().textbox1.value

You can also create formulas that perform calculations on values returned from the Web page. For example, if the text box you're returning a value from contains a sales amount, and cell C1 on the spreadsheet contains a commission rate, you could multiply the value returned from the Web page with the value in the commission rate cell:

=$C$1*HOST().textbox1.value

You can also reference a value in another spreadsheet on the same Web page. For example, if you have spreadsheet1 and spreadsheet2 on a Web page, the following formula in spreadsheet1 returns the value from cell A1 in spreadsheet2:

=HOST().spreadsheet2.range("a1").value

For more information about the functions, controls, and properties you can use on a spreadsheet, see how to access programming Help topics for spreadsheets.