Besides missing few closing brackets and having extra , I don't see issues with the script as @txnelson also said
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(5),
Compress File When Saved(1),
Set Header Height(46),
New Column("Mode", Character, "Nominal", Set Values({"A", "C", "A", "A", "D"}))
);
A = {"96", "104", "112", "120"};
B = {"1", "100", "111", "121"};
C = {"6", "14", "112", "129"};
D = {"9", "124", "132", "160"};
dt << New Column("Value",
Expression,
formula(
If(
:Mode == "A", A,
:Mode == "B", B,
:Mode == "C", C,
:Mode == "D", D
)
)
);
If you need to have a formula and not values in those cells, I would suggest checking out Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute as it will most likely prevent some issues which might occur.
-Jarmo