ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to refer to a cell format code? (https://www.excelbanter.com/excel-discussion-misc-queries/27639-how-refer-cell-format-code.html)

A difficult problem

How to refer to a cell format code?
 
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.

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
InsertMOdule
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



"A difficult problem" <A difficult wrote
in message ...
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.





All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com