Beta
This is a new feature and we can’t wait to hear your feedback. Just let us know. Use with caution: beta features may contain some bugs and rough edges. To test the feature, start a free trial or update to the latest XLTools version.
GPT.EstimateTokens - Estimate token usage for GPT operations in Excel
GPT.EstimateTokens is a utility function that estimates the number of tokens in the given text to help calculate the approximate cost of operations with GPT functions.

Syntax
=GPT.EstimateTokens(text)
Argument | Description |
---|---|
text [required] | Text for which to estimate the token count. Cannot be empty. |
Before you begin, add Functions to Excel
Functions are one of the 20+ features within XLTools Add-in for Excel. Works in Excel 2019, 2016, 2013, 2010, desktop Office 365.

Download XLTools for Excel
Examples [download]
Download this spreadsheet with examples and try the function yourself.
Download examples with this function (xlsx)
Formula | Description | Result |
---|---|---|
=GPT.EstimateTokens("This is a sample text.") | Estimates the token count for the given text. | 6 |
=GPT.EstimateTokens("How many tokens does this longer sentence contain?") | Estimates the token count for a longer sentence. | 9 |
Any questions or suggestions?