Variable extraction from formula string