How to Change Font Within Formula in Excel (3 Easy Ways)

Get FREE Advanced Excel Exercises with Solutions!

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.


How to Change Font Within Formula in Excel: 3 Easy Ways

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 the Excel Options dialog box.

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.

Excel Change Font Within Formula

Follow the steps given below to do that for your dataset.

Steps:

  • Firstly, click on File.

Use Excel Options to Change Font Within Formula in Excel

  • 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.

Opening Excel Option Box to Change Font in Formula Bar in Excel

  • 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.

Manually Changing Font Within Formula Bar in Excel

Here are the steps.

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.

Excel Change Font Within Formula

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 an extra 2 marks with it. We can do it easily by using a formula and VBA.

Change Font Within Formula Using VBA in Excel

Steps:

  • 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

Code Breakdown

  • To start with, we created a VBA 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.

=IF(C5>=C6,C6+2,C5)+Font_Color(C5,C6)

  • Then, drag right the Fill Handle tool to auto fill 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.

Practice Section

In the article, you will find an Excel workbook like the image given below to practice on your own.

Practice Section


Download Practice Workbook

You can download the workbook to practice yourself.


Conclusion

So, in this article, we have shown you 3 ways to change font within the 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. Thank you!


Related Articles

<< Go Back to Excel Fonts | Excel Cell Format | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.

Tags:

Arin Islam
Arin Islam

Anowara Islam Arin, a graduate of Civil Engineering from Khulna University of Engineering & Technology, Bangladesh, serves as a technical content creator in the ExcelDemy project. Possessing a passion for innovation and critical thinking, she actively embraces challenges. Beyond her engineering background, Arin exhibits a keen interest in Excel, having authored numerous articles on Excel & VBA-related issues to simplify the experience for users facing obstacles in Excel. Besides, she is also interested in Advanced Excel,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo