IF statement on formatted cells

consultingexcel

New Member
Joined
Oct 4, 2012
Messages
1
Good Afternoon Excel Experts!

I currently have a set of data that has two currencies: AUD and USD.

In this set of data i have many columns of locations and columns of pricing - the service to be provided is quoted in both AUD and USD for different locations. I would like to make this pricing all AUD in a seperate working tab, however the quoted currencies are differentiated by Currency Formatted Cells.

Question:

Does anyone know how to do an IF statement on a formatted cell i.e =IF(A1 ="USD",A1*0.96,A1) . I have tried this formula but due to the fact that the cells are formatted this formula will not work.

Anyone have any suggestions on how to get around this?

Thanks!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to the board.

Don't think it's possible with the built in Excel functions to do what you want, you're likely to need a custom function. Have a read of this thread I just found:
if statement based on cell's color
 
Upvote 0
You can use the next vba routine to change from USD to AUD. First copy all amounts to where you want to do the conversion, then set the right range in the code and run it.

Code:
Public Sub ConvertUSDtoAUD()
'Numberformats
Const dQ As String = """"
Const sAUD As String = "_ [$AUD] * #,##0.00_ ;_ [$AUD] * -#,##0.00_ ;_ [$AUD] * " & dQ & "-" & dQ & "??_ ;_ @_ "
Const sUSD As String = "_ [$USD] * #,##0.00_ ;_ [$USD] * -#,##0.00_ ;_ [$USD] * " & dQ & "-" & dQ & "??_ ;_ @_ "
Dim r As Range
[COLOR=#ff0000][B]Set r = Sheets(2).Range("A1:A2")
[/B][/COLOR]   For Each c In r
        If c.NumberFormat = sUSD Then
            c.Value = c.Value * 0.91
            c.NumberFormat = sAUD
        End If
    Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,665
Members
449,462
Latest member
Chislobog

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