There is a quiet frustration buried in this question, and we understand it completely. You did everything right: you knew the format string, you applied it exactly as you would in VB or C#, and Excel still refused to respect your wishes. That decimal point, hanging there like a stubborn punctuation mark, is not a reflection of your skill. It is a limitation of the tool you were told to trust. The real issue here is that Excel's number formatting engine has its own quirks, and when you are generating files programmatically with something like ClosedXML, you are not just formatting numbers. You are negotiating with a legacy system that was never designed for the precision you are asking for.
The practical takeaway is this: do not treat the format string as the final answer. Treat it as a starting point. The workaround is not to fight the format string, but to pre-process your data before it ever reaches the cell. If you have values like 1234.5 and 1234, format them in your code first, converting to strings with the exact decimal places you want, then write those strings to the spreadsheet. Yes, it feels less elegant. Yes, it means you are doing more work on your side. But it also means you are not relying on Excel to behave consistently, which is a fragile assumption at best. Your users will see clean numbers, and that is what matters.
What this reveals is a deeper truth about spreadsheet automation: the tool is not the source of truth, the data is. When you generate a file from code, you are the one responsible for its integrity. Excel is just the canvas. So if the canvas insists on adding a dot where none belongs, you adapt. You do not wait for a bug fix or a patch. You build around it. That is not a compromise; that is professionalism.
For anyone building software that outputs Excel files, take this as a reminder to test your format strings against the actual Excel version your users will open, not just the one in your head. And when you find a quirk like this, do not assume it is your fault. But also do not assume it will be fixed. The concrete move here is simple: format your numbers as text when you need absolute control, and reserve Excel's native number formats for cases where you are certain they will behave. Your users will never know the difference, but you will sleep better knowing the output is exactly what you intended.