In the Number tab, choose Custom.
Set the Custom formatting to 000#. (zero zero zero #)
@AshtonSheets yes, as I noted in the answer it only displays the leading zeroes, it does nothing to the actual value. However, there have been situations where I used this instead of =text() because of its convenience and lack of formula involved.
For those with my issue above, the answer was to swap out # (hash) for 0 (zero). The # gives you no character when there's no value but the 0 gives you a zero when there's no value! Makes sense and works great: $0.0,,"M"
I use a variation of this solution to round to millions of dollars: $#,,"M" However this turns $200,000 into $.2M when I would prefer $0.2M. Then I use $0#,,"M" and it gives me my $0.2M format but also changes numbers larger than 1,000,000 into $01.0M format! I seem to be going in circles - is there a solution for getting a 0 before the . ?
Note that this does not actually change the value of the cell. It only displays the leading zeroes in the worksheet.
The more efficient (less obtrusive) way of doing this is through custom formatting.
This works great if there is no need to retain the leading zeroes past the original cell but won't work if the strings need to be used anywhere else. It would make the cells display as 0004, 01032, 0284 but if you tried to combine the strings in a separate cell it would show, for example, 4-1032-284 instead of the desired 0004-01032-0284