Hacker News new | ask | show | jobs
by mrgoldenbrown 438 days ago
Zipcodes aren't really numbers, they are strings. You can't meaningfully do math on zipcodes, so better to just treat them as text.
2 comments

Yes, that's the point. But excel just incorrectly determines what you meant, and corrupts your data.
>But excel just incorrectly determines what you meant

How would you, if you were programming excel, determine whether the 5-digit number entered with a leading 0 is meant to be a zip code or not?

I would not make any default determination until and unless there was a proactive user action. If there is any value that doesn't round trip through string serialization, don't allow it to be coerced without the user deciding to allow it, explicitly.
You know that many users of Excel enter numbers into the cells and then do arithmetic calculations with them right?
No, but I think it's a lot. I'd bet that the vast majority of those round-trip through string serialization, requiring no further user action based on my recommendation.
Disagree, the most common way for an experienced user to type a date into Excel is as a partial date if it is this year, eg 4-Apr, which is instantly converted to 04/04/2025 or whatever.

The vast majority of dates I personally type into Excel would be in this form.

Would keeping the leading zero cause any problems with future calculations?
That's why Excel is cursed. It tries to interpret so many "just strings" as something else.