Explanation
The TRANSPOSE function automatically transposes values in a horizontal orientation to vertical orientation and vice versa.
However, if a source cell is blank (empty) TRANSPOSE will output a zero.
When a cell is blank, the IF function supplied anempty string("") to transpose.
If not, IF supplies the value normally.
More than one condition can be tested by nesting IF functions.