|
Format Cells as a Percentage in Excel Number Formatting
This free Excel macro formats a selection of cells as a Percentage in Excel. This simply changes a cell's number format to the Percentage number format. That will multiply any number by 100 in order to display the correct percentage number, which is what Excel does when you change the number format to Percent.
This Excel macro is great for quickly formatting large selections of cells, rows, or columns in Excel.
Where to install the macro: Module
Excel Macro to Format Cells as a Percentage in Excel Number Formatting
Sub Format_Cell_Percentage()
Selection.NumberFormat = "0.00%"
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
In Excel 2007, I have a cell in Sheet1 with the named range of "currency" and data validation set to list, with currency symbols listed in the drop down. On Sheet1 I used conditional formatting to change the number format of certain cells to match the currency symbol selected in the drop down list using,for example, =currency="$" and it works fine. On Sheet2 I use the same conditional format statement and when I select a currency from the drop down on Sheet1 it will change the format once but if I select a different currency it won't change the number format. What's weird, is if not only do I set the conditional formatting to change the number format but the color of the cell as well, the cell color will change but the number format will not. Is this just a bug in excel or am I doing something wrong?
Thanks
Dear Friends,
Best wishes!!!
In a pivot table a percentage column is added which calculates the percentage automatically. The percentage column shows the value with "%" (Ex. 54.12%). I tried different possibilities, but in vain.
How to avoid / re-format this to show only the value (i.e. I need only the value 54.12 - instead of 54.12%)
Thanks in advance,
acsishere.
Hello,
I've got some numbers on my excel spreadsheet and a cell to calculate the percentage.
For example, I've got cells called:
(C2) Target = 47
(C3) Achieved so far = 46
(C4) Percentage = 97.87%
I've formatted the percentage cell to 2 decimal places.
However, later on in the spreadsheet, I have a formula in C10 saying:
="Percentage of work achieved so far is " & C4
The cell returns "Percentage of work achieved so far is 0.978723404255319
How do I get it to just say 97.87%? Can I format the number within the formula? Or how can I get the string formula in C10 to return just the displayed contents from C4?
Thanks in advance!
Hello,
I am running Excel 2003 and I wish to apply conditional formatting to only cells with format Number. Does anyone knows an easy way of doing this or a VBA code for it?
I have tried on my own to write a code , but as I am new to VBA , I can't figure out how to make it work . The code supposed to compare all the numeric values from an uknown number of columns with numeric values from column B row by row and Bold the ones greater. The number of columns and rows is uknown because the data will be exported from another software to Excel , so bassically I wish to format a woorkbook to automatically do that.
The code is below:
VB:
Sub ConvertsFontStyletoBold()
Dim Count As Integer
Dim Count1 As Integer
Dim nr1 As Range
Dim nr2 As Range
Dim nr3 As Range
Dim nr4 As Range
Dim nr5 As Range
Dim nr6 As Range
Dim nr7 As Range
Dim nr8 As Range
Set nr1 = Range("A65536").End(xlUp)
nr1.Select
Set nr2 = Range("a1").End(xlToRight)
nr2.Select
Count = Range("A1", nr2).Columns.Count - 1
Set nr3 = Range("A1", nr1.Offset(0, Count))
nr3.Name = "Data"
nr3.Select
Set nr4 = Range("B65536").End(xlUp)
nr4.Select
Set nr5 = Range("B7", nr4)
nr5.Select
Set nr6 = Range("D7").End(xlToRight)
nr6.Select
Set nr7 = Range("D65536").End(xlUp)
nr7.Select
Count = Range("D7", nr6).Columns.Count - 1
Set nr8 = Range("D7", nr7.Offset(0, Count))
nr8.Name = "Values"
nr8.Select
For Each r In nr8.Rows
i = r.Row
r.Select
If IsNumeric(Cells(r)) = True And r.xlCellValue > nr5.xlCellValue = True Then
cell.Font.Bold = True
End If
Next r
End Sub
If you like these VB formatting tags please consider sponsoring me in support of injured Royal Marines
Thank you very much for any help received.
I think I know the answer to this but it's worth a shot.
I'm doing a simple calculation... b1-a1... the value needs to be displayed in Currency format $0.00. Is there a formula to have it display in current but also the percent of b1/a1? From all I can search around the web.. no, there's only a solution to present a whole number + percentage in brackets. Ideally the solution would populate the cell in this format - $150.00 (5%)
Thanks!
Hi, First time on the site so here goes...
I have a sheet where the user enters various numeric values (ranging from 0.1 - 1) into a range of cells. I would like to be able to take this range and vary it by a given percentage (entered in another cell).
This percentage will vary many times and when is put back to 100% the range of cells must read their original values.
I'll give an example as i'm not too sure if this is clear:-
Step 1 - 100%, Range of cells entered are 1,1,0.5
Step 2 - 50%, Range of cells change to read 0.5,0.5,0.25
Step 3 - 100%, Range of cells now read 1,1,0.5
I hope this is clear enough.
Thanks in advance
hi
i am trying to format a cell in excel to show the calculation as a percentage.
however instead of showing 14.29% it is showing 1428.57%
how can i fix this?
thanks
Is it possible to change the size of the percentage sign that Excel inserts
in cells when the number in the cell is a percentage? If there are a lot of
percentages in a table, it is very difficult to read the numbers because the
percentage signs detract from the numbers. It would be good if there were a
way to get Excel to automatically insert the percentage sign in a smaller
font.
I am using an autoshape as a progress bar in Excel 2007, and my macro effecectively resizes my rectangle from 0-100% based on the progress through my routine, and I added a line of code that actually writes the percantage into the Rectangles text field, but I can't figure out how to format the text string as a percentage...
Since I am using a variable to load text into the box, without formatting its showing up like this: 6.213545312 when I am at that percentage progress..
I would like it to show up as 6.21%
Is this possible??
In excel, I tried to convert numbers to number format, using
format/cells/number from the category list. But it won't take, and stays
text-like. Any ideas?
|
|