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.
How to use GPT.EstimateTokens function in Excel: understanding token count and cost estimation

Syntax

=GPT.EstimateTokens(text)
ArgumentDescription
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.

Get started with XLTools ribbon
– free trial gives you 14 days of full access to all features.

Examples [download]

Download this spreadsheet with examples and try the function yourself.


FormulaDescriptionResult
=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?
How can we help?