IF formula against currency signs

outtahere

New Member
Joined
Oct 29, 2009
Messages
39
I would like to use an IF formula against cells with different currencies. For example column A has no of units, column b has price and column c has units multiplied by price. The prices are formatted using currency format and have either $ or £ signs. I would like to apply different formula based on these signs. I am using excel 2007.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi there,

the first thing you will need to do is open VBA and add this function to a module

Code:
Function GetFormat(Cell As Range) As String
   GetFormat = Cell.NumberFormat
End Function
once you have this you can use this formula

=IF(LEFT(getformat(D14),1)="$","DollarFormula","PoundFormula")

Edit as you need

That should sort that out for you.
 
Upvote 0
Actualy having tested that it does not seem to work.

Looks like it always turns up the "$" value.

I will have a play see if there is a better way.
 
Upvote 0
Ok so the original one does work but with a minor change

The Formula should be

=IF(LEFT(getformat(D14),1)="$","PoundFormula","DollarFormula")

Code:
Function GetFormat(Cell As Range) As String
Application.Volatile
   GetFormat = Cell.NumberFormat
End Function

As the changes you are making are farmat based they dont triger calculatation so you will need to do that manualy "F9" will do that.

the other way is

Code:
Function TestForDolar(Cell As Range) As String
Application.Volatile
If Cell.NumberFormat = "[$$-409]#,##0.00" Then
TestForDolar = "TRUE"
Else
TestForDolar = "FALSE"
End If
End Function

This gives you a result that can be used in a IF statment. :)
 
Upvote 0
Hi there, thanks for the quick reply, I have never used VBA before. I guess this means there is no standard Excel function for this is there? I may, for the time being do this in a less elegant way by adding a currency column next to the value. This is a quick fix. Then I will start to look at VBA. Appreciate your help.
 
Upvote 0
Hi OUttahere,

It looks and sounds more impresive then it is and once you start you will never stop :)

Before doing any of this save a copy of the spreadsheet as a back up!

press

Alt and F11


this brings up the VBA editor.

on the top left you should see projects find the one with the name of your workbook and click the little cross next to it to expand.

Now right click and select insert -> module

in the new module paste the code I send you (not the formulas just the bits in the indent)

And your away. :)
 
Last edited:
Upvote 0
I would like to use an IF formula against cells with different currencies. For example column A has no of units, column b has price and column c has units multiplied by price. The prices are formatted using currency format and have either $ or £ signs. I would like to apply different formula based on these signs. I am using excel 2007.
If you only have those 2 currency symbols, you may be able to use something like this. I'm not working on Excel 2007 at the moment so my instructions may not be exact. Also, I haven't tested this in Excel 2007.

1. Select cell B2

2. Formulas ribbon|Name Manager|New|Name: nf | Refers to: =GET.CELL(7,!A1)|OK

3. Use a formula similar to this, copied down, to do something different for the 2 currencies. ($ are multiplied by 3, £ are multiplied by 5)

4. After copying the formula down, use the Format Painter to apply the formats from col B to col C so the currency formats match.

Excel Workbook
ABC
1UnitsPriceTotal
21$2.00$6.00
323.0030.00
43$5.00$45.00
Identify Currency
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top