How to refer to a cell format code?

G

Guest

Hi!
I have a huge amount of different money values in diffenet cells, and I need
to separate/sort them according to the currency. The problem is that the
currency has been defined from the cell format menu(Format cell ->custom and
# ##0,00\ "AUD"). If I use the FIND or SEARCH tools, they won't find the text
AUD because it is not typed in to the cell in a "regular" way. So I'm asking
if someone knows how to make a reference to the "AUD" part of the cell format
code, so that I could sort those currencies. If someone knows some way to do
this sorting, I would appreciate, if someone could help me.
 
N

Niek Otten

Use this small User Defined Function (UDF)

Function CurrencyFormat(a As Range) As String
CurrencyFormat = a.NumberFormat
End Function

Open the VB Editor, ALT+F11
Insert>MOdule
paste the function text into the module

You can now use the function in your worksheet to create an extra column and
use that for sorting--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top