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"
);
));
![jthi_0-1636045800547.png jthi_0-1636045800547.png](https://community.jmp.com/t5/image/serverpage/image-id/37287i5981F03531237882/image-size/medium?v=v2&px=400)
You can then modify the formula as required.
-Jarmo