Looking for ways to change font within formula in Excel? Then, this is the right place for you. By changing the font within the formula, you may make it easily visible and also change its color, font style, making it bold or italic. Here, you will find 3 ways to change font within formula in Excel.
Download Practice Workbook
You can download the workbook to practice yourself.
3 Easy Ways to Change Font Within Formula in Excel
Now, we will show you 3 methods to change the font in the formula bar and also change the font within the formula using VBA in Excel.
1. Use Excel Options to Change Font Within Formula in Excel
Sometimes, you may want to show a formula in the formula bar. However, you cannot change its font size by zooming in or out. In that case, you may use Excel Options.
Here, we have a dataset containing the Product list and the Sales value of a shop. We used the SUM function to calculate the Total Sales of that shop and showed the formula in the formula bar. Now, we will show you how you can change the font size in the formula bar.
Follow the steps given below to do that for your dataset.
- Firstly, click on File.
- Then, click on Options.
- Now, the Excel Options toolbox will open.
- Next, from the General option, change the Font size according to your wish.
- Here, we selected 16 as Font size.
- After that, click on OK.
- Afterward, a Msgbox will open to inform you to reopen the Excel File.
- So, click on OK and reopen your file to see the changes.
- Finally, you will see that the font size in the formula bar has been changed.
Read More: How to Change Default Font in Existing Excel Workbook
2. Manually Changing Font Within Formula Bar
Now, suppose you want to change the font of some particular text or number in a cell. You can do this by selecting that cell and then manually changing fonts within the formula bar in Excel.
Here, in our dataset, we have a statement in Cell B5. Now, we will change the font of the text “James” and date “1st February 2023” manually within the formula bar.
Here are the steps.
- Firstly, select Cell B5 and go to the formula bar.
- Then, select the text “James”.
- After that, change the font color, style, and size according to your wish.
- Here, we will set Abadi as Font, 16 as Font Size, and Red as Font Color, and click on Bold to bold the text.
- Next, to change the font of the date, we will select “1st February 2023”.
- Then, we will set 16 as Font Size and click on Bold and Italic to change its font.
- Thus, you can manually change the font within formula bar in Excel.
Read More: [Solved]: Font Changes Automatically in Excel
3. Change Font Within Formula Using VBA in Excel
In the last method, we will use VBA to change the font color within the formula under specific conditions in Excel. Here, we have a dataset containing the Score of some students and the Highest Score of them. Now, suppose we want to identify the highest score with a different font color and add extra 2 marks with it. We can do it easily by using a formula and VBA.
- In the beginning, press Alt + F11 on your keyboard or go to the tab Developer >> click on Visual Basic to open Visual Basic Editor.
- Then, from the menu bar, click on Insert >> select Module.
- Next, copy the following code and paste it into the code window.
Function Font_Color(M1 As Double, M2 As Double) As Boolean If M1 >= M2 Then Application.Caller.Font.ColorIndex = 3 Else Application.Caller.Font.ColorIndex = xlAutomatic End If End Function
- To start with, we created a Function named Font_Color and took M1 as M2 as variables where we set both of them as Double.
- After that, we checked If M1>=M2, then the Font Color will change or otherwise it will remain the same.
- Next, click on the Save button to save the code.
- Afterward, insert the following formula in Cell C7 and press Enter.
- Then, drag right the Fill Handle tool to AutoFill the formula for the rest of the cells.
- Finally, you will get the Final Score of the students and the Font Color of the highest value has been changed according to the formula.
🔎 How Does the Formula Work?
- To start with, we used the IF function to check if the value of Cell C5 is greater than or equal to Cell C6, then it will return the value of Cell C6 + 2 or else it will return the value of Cell C5.
- Then, we used the Font_Color function that we created using VBA to change the Font Color.
Read More: How to Change Font in Excel for All Sheets (3 Suitable Ways)
In the article, you will find an Excel workbook like the image given below to practice on your own.
So, in this article, we have shown you 3 ways to change font within formula in Excel. I hope you found this article interesting and helpful. If something seems difficult to understand, please leave a comment. Please let us know if there are any more alternatives that we may have missed. And visit ExcelDemy for many more articles like this. Thank you!