You don't need to store it in a variable.
Example below. Run the script and check the formula for MonthNumber:
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(4),
New Column("Time", Character, "Nominal", Set Values({"M-12", "M-36", "EOS-968", "EOS-1011"}))
);
dt << New Column("MonthNumber", Numeric, Continuous, Formula(
If(StartsWith(:Time, "M"),
Num(Word(2, :Time, "-"))
,
StartsWith(:Time, "EOS"),
Num(Word(2, :Time, "-"))/30
,
. //if starts with something else than "M" or "EOS"
);
));
You can then modify the formula as required.
-Jarmo