My answer is 237 and my approach is not vary smart. would like to know if they are more wise method for it. Here is my thinking: $3^5= 243. $ Then minus 15, since
(1) 0 0 0 0 or 0 0 0 0 (1),
(2) 0 0 0 0 or 0 0 0 0 (2), 0 0 0 0 0,
(0) 1 1 1 1 or 1 1 1 1 (0),
(2) 1 1 1 1 or 1 1 1 1 (2), 1 1 1 1 1,
(0) 2 2 2 2 or 2 2 2 2 (0),
(1) 2 2 2 2 or 2 2 2 2 (1),
(0) 2 2 2 2 or 2 2 2 2 (0), 2 2 2 2 2,
Wondering if there is any formula to calculate more systematically?
I don't think you will get more systematic, except that you might do that counting in fewer steps by saying in pseudocode logic if $(x \neq A)$ $\{xAAAA~\text{or}~AAAAx\}~\text{else}~\{xAAAA\}$ where $x,A \in \{0,1,2\}$ implies a count of $2 \cdot 3 \cdot 2 + 1 \cdot 3 \cdot 1 = 15$.
The advantage here is we can compute the number if our digits are a higher base. As is, it isn't definitively simpler.