Domanda

I'm using a formula in Excel 2007 to grab a mailbox size from a string. I'm stripping out all of the text before and after, and removing the , characters, yet Excel will not format the result as a number.

Because of this, I can't run any statistics such as total size or average size.

=SUBSTITUTE(MID(MailboxEX01[[#This Row],[TotalItemSize]], FIND("(", MailboxEX01[[#This Row],[TotalItemSize]]) + 1, FIND("bytes", MailboxEX01[[#This Row],[TotalItemSize]]) - (FIND("(", MailboxEX01[[#This Row],[TotalItemSize]]) + 2)), ",", "")

I tried =TEXT({the above}, "#,##0"), which successfully added the , character as the thousands separator, but (I guess unsurprisingly) still failed to format the cell as a number.

Does anybody know how I can force the result in this cell to format as a number? Thanks.

È stato utile?

Soluzione

Your formula takes text values, strips stuff out, and replaces stuff. But the result is still text. If the result of that formula contains only the characters 0 to 9, you can coerce it into a number by using

={your formula}+0

or

={your formula}*1

or

=--({your formula})

Using =TEXT({your formula}, "format") will not produce a number. The TEXT() function returns text, as the name implies.

But if you use a mathematical operator on a number that is stored as text (or a text that represents a number), the maths operation will coerce that text value into a real number. The third suggestion uses the double unary (Google that) to coerce the text into a number.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top