ETF model question

If there is an etf with history going back to 2005 and a similar etf with history going back to 1998, what is the best formula to use in a 1 etf Sim to say “if data for etf A is available buy A, otherwise buy etf B”?

Thanks

Eval (Close (0, Getseries (“A”)) <> NA, Ticker (“A”), Ticker (“B”))

There may be a more elegant solution, but this one seems to work.

Here is the formula to use FXH when available, otherwise use XLV. Both are healthcare ETFs.

Eval(Close(0,GetSeries(“FXH”))=NA,Ticker(“XLV”),Ticker(“FXH”))

Thanks Georg and Yuval. Much appreciated.