Start using GPT functions in Excel
GPT functions are custom spreadsheet functions in GPT for Excel that allow you to prompt AI from inside spreadsheet cells. GPT functions work exactly like native functions in that you can use them on their own or combine them with other functions when creating formulas.
This guide walks you through the basics of using GPT functions — from enabling GPT functions for a workbook to building formulas that combine GPT functions with native functions. The focus is on the GPT
function, the simplest function included in GPT for Excel, but the same rules apply to all GPT functions.
To try out the examples in this guide, download our examples template, and open it in Excel as a new workbook.
Enable GPT functions
GPT for Excel must be running before you can use GPT functions in a workbook.
To start GPT for Excel:
Open the workbook where you want to use GPT functions.
In the Home tab, click GPT for Excel Word.
infoYou can also select Home > Add-ins > My Add-ins > GPT for Excel Word.
Use GPT functions
Learn the basics of using GPT functions, from how you write a function to what you need to keep in mind when using the functions.
GPT function syntax
Each GPT function follows a specific syntax that consists of a function name and one or more parameters (also called "arguments") enclosed in parentheses. The parameters together tell the function what to do. Some parameters are required, while others are optional. The syntax of a function is presented as follows:
The order of the parameters matters, so always write them in the order required by the function syntax. Optional parameters are in square brackets.
For example, the GPT
function has the following syntax:
The GPT
function takes the following four parameters:
Parameter | Required | Description |
---|---|---|
| Yes | The prompt for the AI. The prompt can be:
|
| No | Input that you want to append to the prompt. The input can be:
The final prompt sent to the AI is |
| No | Number between 0 and 1 that specifies how creative the AI should be in generating the response. |
| No | Name of the AI model that you want to use. You can find the model names in the model switcher in the add-in sidebar. Learn more. |
The first parameter of the GPT
function is required, so you always have to provide it. The remaining three parameters are optional, so you only need to provide them when you want additional control over how the function operates. You can provide one, two, or all three optional parameters, depending on your needs.
If a parameter takes a text value, always enclose the text in double quotation marks. For example:
✅ GPT("Write a tagline for a tea house")
❌ GPT(Write a tagline for a tea house)
The latter fails with an error because the function cannot interpret the words as valid parameters.
If you skip an optional parameter other than the last one, always provide a lone comma ("empty parameter") as a placeholder to maintain the correct syntax. For example:
✅ GPT("Write a tagline for a tea house", , 0.5, "claude-4-sonnet")
❌ GPT("Write a tagline for a tea house", 0.5, "claude-4-sonnet")
The latter fails with an error because the function treats 0.5
as the second parameter (value
, which expects text or a reference) and "claude-4-sonnet"
as the third parameter (temperature
, which expects a number).
Run a GPT function
To use the GPT
function:
Select a cell where you want the response to appear.
Type the equal sign
=
followed by the function. For example, to use theGPT
function with just theprompt
parameter, type:=GPT("Write a tagline for a tea house")
Press ENTER.
The function runs: It sends the prompt to the AI, receives a response, and displays the response in the selected cell.
The text you see in the cell is a dynamically calculated value — the result of the formula. The actual value of the cell is the formula expression: =GPT("Write a tagline for a tea house")
. You cannot edit the calculated value; you can only edit the formula. If you want to set the calculated value as the actual value of the cell, that is, if you want to turn the calculated value into a constant that you can edit, replace the formula with its result.

Reference other cells from a GPT function
You can reference other cells and ranges from a GPT function. You can use relative, absolute, and mixed references as you would with any formula.
For example, to retrieve the prompt for the GPT
function from another cell:
Select a cell and enter the prompt:
Write a tagline for a tea house
tipYou do not need double quotation marks around the prompt here because Excel automatically returns the value as text.
Select another cell and enter the
GPT
function with the prompt cell as the only parameter. For example, if the prompt is in cellB12
, enter:=GPT(B12)
The function runs and returns the AI's response in the selected cell.
Both GPT(B12)
and GPT("Write a tagline for a tea house")
work the same way — they send the exact same prompt to the AI. The only difference is that the former retrieves the prompt from a cell, while the latter provides it directly as a text constant in the function.
Apply the same prompt to multiple cells
You can apply the same GPT function and prompt to adjacent cells by filling the formula across a range.
For example, suppose you want to generate unique taglines for multiple businesses. The businesses are listed in one column of your sheet, and you want to fill another column with the corresponding taglines. You can generate the taglines by using the GPT
function with the prompt
and value
parameters, where prompt
specifies the basic instructions and value
specifies a specific business as a cell reference:
Select the first tagline cell and enter the
GPT
function. For example, if the business whose tagline you're generating is specified in cellB7
, enter:=GPT("Write a tagline for", B7)
The function combines the two parameters into a single prompt, which it then sends to the AI. For example, if
B7
contains the textantique store
, the final prompt sent to the AI is:The function runs and returns the AI's response in the selected cell.
Fill the formula down to apply it to the rest of the column: Select the fill handle and drag it down across the cells you want to fill. Excel automatically updates the cell reference in the function so that each row receives a tailored response based on its business. The formula in row 8 will reference
B8
, the formula in row 9 will referenceB9
, and so on.
To see how absolute references work, let's move the prompt to its own cell:
Select an empty cell and enter the prompt:
Write a tagline for
Select the first tagline cell and update the
GPT
function to reference the prompt cell. For example, if the prompt is in cellC6
, enter:=GPT($C$6, B7)
$C$6
is an absolute reference toC6
, which you need here since you do not want Excel to automatically adjust the reference when you fill the function to adjacent cells.tipSince you're only filling vertically across a single column, it would be enough to fix the prompt cell row using a mixed reference:
=GPT(C$6, B7)
Fill the formula down to apply it to the rest of the column: Select the fill handle and drag it down across the cells you want to fill, overriding the existing formulas. Excel automatically updates the business cell reference for each row, while keeping the prompt cell reference fixed.
Create a prompt by combining text from multiple cells
You can use concatenation to combine text from two or more cells into a single text string. This allows you to create complex prompts, where different parts of the prompt come from different cells in the sheet.
For example, suppose you want to further customize the taglines of the previous example, so that they follow a specific tone and target a specific customer age range. The businesses are listed in the first column, the tone in the second, and the age range in the third, with the fourth column now reserved for the taglines.
To build the prompt by combining the information from the different columns:
Select the first tagline cell and enter the
GPT
function. For example, if the business whose tagline you're generating is specified in cellB9
, with the tone in cellC9
and age range in cellD9
, enter the following in cellE9
:=GPT("Write a tagline for " & B9 & ", the tone is " & C9 & ", the audience is aged " & D9)
The function uses the
&
operator to concatenate the different parts, which include literal text values and cell references, into a single text string. For example, ifB9
contains the textantique store
,C9
containsnostalgic and refined
, andD9
contains35-65
, the final prompt sent to the AI is:tipInstead of the
&
operator, you can also use the nativeCONCAT
function:=GPT(CONCAT("Write a tagline for ", B9, ", the tone is ", C9, ", the audience is aged ", D9))
The
GET
function uses theCONCAT
function as a nested function. Learn more.Fill the formula down to apply it to the rest of the column: Select the fill handle and drag it down across the cells you want to fill. Excel automatically updates the cell references in the function so that each row receives a tailored response based on its business. The formula in row 10 will reference
B10
,C10
, andD10
; the formula in row 11 will referenceB11
,C11
, andD11
; and so on.
Combine GPT functions with native functions
You can combine GPT functions with native functions like you would any other function.
For example, suppose you want to run the GPT
function from above only when the current row has a business specified. If the business cell is empty, you want to skip the row. You can do this by combining the GPT
function with the native IF
function:
Select the first tagline cell and enter a formula that wraps
GPT
inside anIF
statement. For example, if the business whose tagline you're generating is specified in cellB9
and the GPT function for that isGPT($C$6, B9)
, enter:=IF(B9="", "", GPT($C$6, B9))
The
GPT
function runs only if cellB9
is not empty. IfB9
is empty, the formula leaves the current cell empty, too.Fill the formula down to apply it to the rest of the column: Select the fill handle and drag it down across the cells you want to fill, overriding the existing formulas. Excel automatically updates the business cell reference for each row, while keeping the prompt cell reference fixed.
To see the conditional logic in action, empty one of the business cells. The formula for that row reruns and removes the tagline.
GPT functions: Defaults, settings, behavior
Default model
By default, GPT functions use the currently selected model. If you want a GPT function to use a specific model regardless of what's currently selected in the model switcher, use the model
parameter to explicitly set the model.
If you provide the model
parameter, and if the model is available both with and without an API key in GPT for Excel, the function uses the model with the API key.
Use the model
parameter when:
You want to lock a formula to a specific model. For example, if you have a web search formula, you want it to consistently use the same web search model.
You want to compare how a specific model compares with other models. For example, use the same GPT function and prompt in two formulas — the first with the
model
parameter, the second without — and then use the model switcher to change the model used by the second formula, regenerating its response after each change.
Default creativity level
By default, GPT functions use the creativity level defined in the model settings. If you want a GPT function to use a specific creativity level regardless of what's defined the model settings, use the temperature
parameter to explicitly set the creativity level.
Global instructions and advanced settings
The global instructions and advanced settings defined in the GPT for Excel sidebar apply to GPT functions. If you find that a function is not working as expected, check the model settings for a possible cause.
Regional settings
The default characters used by Excel for parameter and decimal separators depend on your region:
Parameters: Some regions use the comma (
,
) as the default parameter separator, while others use the semicolon (;
).Decimals: Some regions use the period (
.
) as the default decimal separator, while others use the comma (,
). As a rule, regions that use the period for decimals use the comma for parameters, whereas regions that use the comma for decimals use the semicolon for parameters.
The examples in the current documentation use the comma as the parameter separator and the period as the decimal separator. If the examples fail with syntax errors in your workbook, check your regional settings to verify which punctuation to use.
Formula auto-refresh
When your sheet auto-refreshes, Excel automatically recalculates some or all formulas on the sheet, including GPT formulas. For each GPT formula:
If the GPT formula cache is enabled for the workbook, Excel reuses the formula's previously generated result from the cache.
If the cached result has expired, or if you have the cache disabled, Excel runs the formula normally.
In Excel, the following triggers cause a sheet to auto-refresh:
Recalculation trigger | What gets recalculated |
---|---|
Insert, move, or delete a column | All formulas on the sheet |
Insert, move, or delete a row | All formulas on the sheet |
Filter rows by column | All formulas on the sheet |
Hide and unhide rows | Formulas in the selected rows |
Sort rows | Formulas in the selected rows |
Move a formula to a different cell | All formulas on the sheet |
Undo the deletion of a formula from a cell | Restored formula |
To prevent GPT formulas from being recalculated, replace the formulas with their results.
When to use bulk AI tools
Consider using bulk AI tools instead of GPT functions if:
You want AI responses saved as plain text in cells. Bulk AI tools fill cells with static text values, or constants, so you don't need to replace any formulas. You also avoid auto-refresh, reducing the risk of unintended data changes.
You want better tracking information about the progress of AI requests. Bulk AI tools provide a live progress tracker that shows you how many rows have been successfully processed, how many have resulted in an error, and how much time has elapsed.
Your formulas regularly become stuck in the #BUSY! state.
What's next
Learn how to use the GPT functions by example.
Browse all our GPT function resources.
Select the model that best fits your needs.
Configure the model settings to customize how the currently selected model operates.