RTD function

RTD returns live data from a registered COM server, delivering the requested value or array directly into the spreadsheet cell.

=RTD(prog_id, server, topic1, ...)

Generate a RTD formula

Describe what you need. The generator will reach for RTD where RTD is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How RTD reads its arguments
prog_idrequiredserverrequiredtopic1requiredRTD
ArgumentRequiredDescription
prog_idRequiredString that identifies the COM server; must be registered on the machine or else Excel raises #NAME?.
serverRequiredString naming the server host; required unless the server runs locally, and an empty string triggers a #REF! error.
topic1RequiredFirst topic string that tells the server what data to return; if the topic is unknown the function returns #VALUE!.
...RepeatingOptional additional topic strings that further qualify the request; each must follow the server's documented syntax.

Returns

A single value or a two-dimensional array, depending on what the server supplies.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Get current quantity of tomatoes

Qty
45
=RTD("RestaurantStockServer","","Qty","Tomatoes")

Result: 45

The RTD call contacts the RestaurantStockServer COM object, asks for the "Qty" topic scoped to the ingredient "Tomatoes", and receives the live inventory count of 45 kilograms. Because the server returns a single scalar, the formula places the number directly in the cell.

2. Retrieve expiry date for lettuce

Expiry Date
2024-10-12
=RTD("RestaurantStockServer","","Expiry","Lettuce")

Result: 2024-10-12

Here the topic "Expiry" combined with the ingredient "Lettuce" tells the server to look up the stored expiration date. The COM server returns the date as a text string, which Excel automatically interprets as a date value that can be formatted or used in further calculations.

3. Pull full stock table for all ingredients

IngredientSupplierUnitQtyExpiry
TomatoesFreshFarmkg452024-09-30
LettuceGreenLeafpcs302024-10-12
CheeseDairyCokg122025-01-15
=RTD("RestaurantStockServer","","FullTable")

Result: A 4-row by 5-column array containing the complete stock-take.

When the "FullTable" topic is supplied without additional qualifiers, the server streams the entire inventory dataset as a two-dimensional array. Excel spills the array into the surrounding cells, creating a live view that updates whenever the underlying COM server pushes new values.

Common errors

Which RTD error are you seeing?
RTD returned an error#NAME?
Install the correct COM add-in and use the exact prog_id string that the provider’s documentation specifies.
#REF!
Enter the proper server host name, for example "LocalHost" or the network name of the machine hosting the RTD server.
#VALUE!
Check the server’s topic list and correct the spelling, case, or order of the topic arguments.
ErrorWhy it happensHow to fix it
#NAME?The prog_id supplied does not match any registered COM server on the computer, so Excel cannot locate the RTD provider.Install the correct COM add-in and use the exact prog_id string that the provider’s documentation specifies.
#REF!The required server argument is omitted or left blank when the server name is mandatory, causing Excel to treat the reference as invalid.Enter the proper server host name, for example "LocalHost" or the network name of the machine hosting the RTD server.
#VALUE!One of the topic strings does not exist in the server’s topic hierarchy, such as misspelling "Qty" as "Qtyy".Check the server’s topic list and correct the spelling, case, or order of the topic arguments.

Tips and when to use something else

  • Use RTD only for data that changes frequently (e.g., live inventory levels) because the server can push updates without manual refresh.
  • Remember that prog_id and topic strings are case-sensitive; a mismatched case will produce #VALUE! even if the word looks correct.
  • For static look-ups that never change, prefer VLOOKUP, XLOOKUP, or INDEX/MATCH, which are faster and do not require a COM server.
  • Wrap an RTD call inside LET to store the result in a named variable, reducing the number of times the server is queried within a complex formula.

Frequently asked questions

Can RTD pull data directly from a public web API?
No. RTD works exclusively with COM servers that expose a real-time data interface. To fetch web data you would use Google Sheets’ IMPORTXML or Excel’s WEBSERVICE function, possibly combined with a custom Apps Script or Power Query wrapper.
Why does my RTD formula return #N/A even though the server is running?
#N/A indicates that the server could not locate any data for the supplied topic combination. Verify that the ingredient name, supplier, or other qualifiers exactly match the values the server expects, and ensure that the data source (e.g., a database) actually contains a record for that request.
Does RTD automatically refresh when the underlying data changes?
Yes. A well-implemented RTD server notifies Excel whenever its data changes, causing the cell to recalculate instantly. This push model eliminates the need for manual recalculation or timer-based refreshes.
Is RTD available in Google Sheets?
Google Sheets does not have a native RTD function, but you can simulate similar behavior with a custom Apps Script that calls an external service and returns values via a user-defined function. The syntax and performance differ from Excel’s built-in RTD.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator