How to use conditional formatting with IF function in Microsoft Excel

In this article we will learn how to color rows based on text criteria we use the “Conditional Formatting” option. This option is available in the “Home Tab” in the “Styles” group in Microsoft Excel.

**Conditional Formatting **Excelis used to highlight the data on the basis of some criteria. It would be difficult to see various trends just for examining your Excel worksheet. Conditional Formatting in excel provides a way to visualize data and make worksheets easier to understand.

**Excel Conditional Formatting** allows you to apply formatting basis on the cell values such as colors, icons and data bars. For this, we will create a rule in excel Conditional Formatting based on cell value

**How to write an if statement in excel?**

**IF function **is used for logic_test and returns value on the basis of the result of the logic_test. Excel conditional formatting formula multiple conditions uses Statements like less than or equal to or greater than or equal to the value are used in IF formula

Syntax:

=IF (logical_test, [value_if_true], [value_if_false]) |

Let’s learn how to do conditional formatting in excel using IF function with the example.

Here is a list of Names and their respective Scores.

multiple if statements excel functions are used here. So, there are 3 results based on the condition. if then statements in excel is used via excel conditional formatting formula

**Write the formula in C2 cell.**

**Formula**

=IF(B2<50,”C”,IF(B2<75,”B”,”A”)) |

**Explanation:**

**IF **function only returns 2 results, one [value_if_True] and Second [value-if_False]

First **IF **function checks, if the score is less than 50, would get C grade, The Second** IF **function tests if the score is less than 75 would get B grade and the rest A grade.

Copy the formula in other cells, select the cells taking the first cell where the formula is already applied, use shortcut key **Ctrl + D**

Now we will apply conditional formatting to it.

Select **Home >****Conditional Formatting > New Rule**.

A dialog box appears

Select **Format only cells that contain > Specific text **in option list and write C as text to be formatted.

Fill **Format** with Red colour and click **OK**.

Now select the colour Yellow and Green for A and B respectively as done above for C.

In this article, we used IF function and Conditional formatting tool to get highlighted grade.

As you can see excel change cell color based on value of another cell using IF function and Conditional formatting tool

Hope you learned how to use conditional formatting in Excel using IF function. Explore more conditional formulas in excel here. You can perform Conditional Formatting in Excel 2016, 2013 and 2010. If you have any unresolved query regarding this article, please do mention below. We will help you.

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Excel Forum is a good forum for learning

Thanks for your appreciation

great

good

Thanks Obaye West

What if Column C had numbers (they are weekly grades), and you wanted to show a trend (arrows) comparing progress of each student from the current week (column c) from the previous week (column b)

Patrick, most font sets have arrows in them. if you go into the start menu and in the search box, type “character map”. In the character map, you can copy characters and paste them into the formula. So in your case, the formula would look like:

=IF(C2>B2,”?”,IF(C2=B2,””,”?”))

My arrows got converted to question marks, but where you see the question marks in the formula, you would copy and paste the up and down arrows from the character map.

Hi, i was wondering if you can conditionally format under a number of conditions. For example.

If cell a1 is less than 0.05 then format cell b2 if it is greater than 0.5, if cell a1 is 0.05-0.10, then format cell b2 if it is greater than 0.25, if cell a1 is between 0.1 and 0.5 the format cell b2 if it is greater than 0.15…..does this makes sense? Can you have multiple conditions on multiple cells for formatting on one cell?? Please help.

I ran a conditional formatting rule to find duplicates in column A (=COUNTIF($A$1:$A$3556,$A1)>1) …. which gave me my duplicates

Now i want to run a second rule to search for duplicates in column B but but only against the highlighted rows from my conditional formatted search. —

end result: i just want to check the duplicate rows to see if the info in column B is different.

( column A – addresses, column B first name column C last name)

I don’t care about last name i need to see if there is duplicate first name record against the duplicate address result. Please help

Hi Imran,

As you mentioned that you have got the duplicates value (highlighted by conditional formatting) in column A and now you want to lookup the corresponding value whether it is duplicate or not against the highlighted value?

Here is the formula which you have to apply through conditional formatting in column B (assuming your data starts from row 2).

`=COUNTIFS($A:$A,$A2,$B:$B,$B2)>1`

The above formula will highlight the duplicate values in column B for the highlighted duplicates value in column A.

Happy Learning,

Site Admin

I’m trying to use conditional formatting using an IF statement to change a cell to 0 with a strikethrough if the cell is less than or equal to 0. Would anyone know how to do that if possible? Thanks in advance!

Hi Brad,

You can’t change any value using conditional formatting as it will only allow you to format the range/cell based on condition entered.

In case you only want to strikenthrough the cell if negative value is entered, simply select the cell and open Conditional Formatting dialog box.

Go to “Format only cell that contain” and select “Cell Value” as “Less than or equal to” and put 0 in the input box. After that, click on Format and click on “Strikenthrough” and then hit OK twice.

You can test the condition now as it should work.

For more Excel Queries, we request you to please login on Excel Forum and post your queries there to get the instant solution for the same.

Regards,

Site Admin

Hi,

I have data as follows:

B1:F13 (5 random numbers in each row)

And another set of numbers

J1:Q2 (16 numbers)

I used conditional formatting to highlight the duplicate values.

I would appreciate if anyone can assist with an if statement that would return “1″ if only 3 numbers are highlighted, 4 if 4 numbers are highlited and 10 if 5 numbers are highlighted.

Thank you

hi,

I have to enter value everyday for nest cell to last week

now if that sale value is greater then last week green colour

if not red colour

please help