gergo1001

New Member
Joined
Oct 26, 2018
Messages
8
Hi All,

I'm trying to show the inverse percentage of a number, and I am struggling to figure out how to do it. Can you please give a it a look and let me know if you can help me. So basically what I'm trying to achieve is if its comes up as 99% I would like it to show as 1%. Here is the Macro which convert the numbers into percentage.

Sub Convert2019VariancePercentage()
'
' Convert2019VariancePercentage Macro
'


'
Range("R:R,U:U,X:X,AA:AA,AD:AD").Select
Range("AD1").Activate
ActiveWindow.SmallScroll ToRight:=8
Range("R:R,U:U,X:X,AA:AA,AD:AD,AG:AG,AJ:AJ,AM:AM").Select
Range("AM1").Activate
ActiveWindow.SmallScroll ToRight:=12
Range("R:R,U:U,X:X,AA:AA,AD:AD,AG:AG,AJ:AJ,AM:AM,AP:AP,AS:AS,AV:AV,AY:AY"). _
Select
Range("AY1").Activate
ActiveWindow.SmallScroll ToRight:=5
ActiveWindow.ScrollColumn = 39
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 1
Selection.NumberFormat = "0.0%"
ActiveWindow.ScrollColumn = 43
ActiveWindow.ScrollColumn = 39
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 1
Range("P4:P5").Select
End Sub



Many Thanks

gergo1001
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hello,

Why a macro ...???

What about a simple formula

=1 - yourPercentage

HTH
 
Upvote 0
Clearly you used the Macro Recorder to create that, and you ended up recording a lot of unnecessary steps. The only significant line is where you set the number format, so the entire macro could be replaced with:

Code:
Sub Convert2019VariancePercentage()
'
' Convert2019VariancePercentage Macro

     Range("AY1").NumberFormat = "0.0%"

End Sub

As far as creating the "inverse percentage", as described, all you need to do is subtract the percentage from 1, e.g.

=1-A1

However, depending on what you're doing, that could be mathematically suspect. What are you trying to achieve?
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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