HOW TO USE CONDITIONAL FORMATTING BASED ON TEXT IN EXCEL

INTRODUCTION

Whenever we prepare any report in excel, we have two constituents in any report.

The Text portion and the Numerical portion.

But just storing the text and numbers doesn’t make the super reports. Many times we need to automate the process in the reports to minimize the effort and improve the accuracy.

Many functions are provided by the Excel which work on Text and give us the useful output as well. But few problems are still left on which we need to apply some tricks with the available tools.

THIS WAS AN EXCERPT FROM THE FIRST ARTICLE OF THIS SERIES MANIPULATING TEXT IN EXCEL – PART I

In this articles , we will continue learning many more techniques about the manipulation of text in Excel.

HOW TEXT IS HANDLED IN EXCEL?

TEXT is simply the group of characters and strings of characters which convey the information about the different data and numbers in Excel. Every character is connected with a code [ANSI].

Text comprises of the individual entity character which is the smallest bit which would be found in Excel.

We can perform the operations on the strings[Text] or the characters.Characters are not limited to A to Z or a to z but many symbols are also included in this which we would see in the later part of the article. 

TEXT IS AN INACTIVE NUMBER TYPE[FORMAT] IN EXCEL. ANYTHING STORED AS TEXT [NUMBER OR DATE] WON’T RESPOND TO ANY STANDARD FORMULAS OR FUNCTIONS BUT SPECIALLY DESIGNED TEXT FUNCTIONS. [EXCEPTIONS DO OCCUR IN CASE OF NUMBERS]

If we need to make anything inactive, such as Date to be non responding to the calculation, we put it as a text. Similarly if we want to avoid any calculations for a number it needs to be put as a text.     

CONDITIONAL FORMATTING BASED ON TEXT

CONDITIONAL FORMATTING is the process of formatting in Excel on the basis of the conditions. We can put many conditions in the cell and program the Excel to make the formatting , as desired, if the particular condition is met. Formatting comprises of the foreground color, background color, font, size etc. which are the properties of the text.

It makes the results more readable.

IT IS RECOMMENDED TO LEARN THE BASICS ABOUT CONDITIONAL FORMATTING, IF NOT VERY COMFORTABLE WITH THIS TOPIC.

CLICK HERE TO LEARN ABOUT CONDITIONAL FORMATTING.

Maximum times, we apply the conditional formatting on the basis of values present in the cells. Let us now learn the way by which we can apply the conditional formatting using the Text.

HIGHLIGHTING THE TEXT EQUAL TO SOME VALUE:

Let us find out the cell which contains a text value equal to some SPECIFIED TEXT.

For the example let us take this block of text values in Excel.

HELLOHOWARE YOURED
GREENYELLOWBLUEGREYWHITE
BIGBUFFALOZEBRAXYLOPHONESMALL
BLACKAPPLEMANGOGUAVAONION
PUMPKINOKRAKIWIPOTATOSPRING

 Let us try to highlight the cells containing HELLO.

It can be done in two ways.

1. Using the predefined options.

2. Using custom formula.

 STEPS to highlight cells using the predefined option:

  •  Select the complete table.
  • Go to HOME TAB>CONDITIONAL FORMATTING>HIGHLIGHT CELL RULES>EQUAL TO
HIGHLIGHTING A CELL CONTAINING A SPECIFIC WORD
  • Click EQUAL TO.
  • Following dialog box will open.
  • Enter the value in the field as shown in the picture.
  • Select the format of the cells which satisfy the condition.
  • and Click OK.
ENTER THE VALUE AND SET THE FORMAT
  • After clicking OK, we will see the result as the cell with HELLO will be in pink. [The option doesn’t differ the cases. Both of upper and lower cases will be taken as same.]
  • Similarly we can find other values too.

2. Using custom formula.

 STEPS to highlight cells using the custom formula:

  •  Select the complete table.
  • Go to HOME TAB>CONDITIONAL FORMATTING>NEW RULE.
  • A dialog box as shown in the picture below will open.
  • Click the last option: use a formula to determine which cells to format.
CUSTOM FORMULA FOR CONDITIONAL FORMATTING IN EXCEL
  •  Enter the formula in the field as =E6=”HELLO”.
  • Set the format as per your choice. We set the fill color as green.[Don’t forget to change the format otherwise difference won’t be visible.]
  • Click OK.
  • The result will be highlighted as shown in the picture below.

For the concept OF CONDITIONAL FORMATTING CLICK HERE.

EXAMPLE 2:STEPS TO  HIGHLIGHT THE TEXT MATCHING THE GIVEN TEXT [EXACT MATCH]

In this example, let us find out the way to highlight the cells which contains the text same as some specified text exactly with the same content and with the same case. GENERALIZED FORMULA TO HIGHLIGHT THE EXACT TEXT:=EXACT(FIRST CELL OF SELECTION, “TEXT TO BE MATCHED”).For our example, we will highlight the cell containing the text “Yellow”. Follow the steps.

  • Select the complete table.
  • Go to HOME TAB>CONDITIONAL FORMATTING>NEW RULE.
  • A dialog box as shown in the picture below will open.
  • Click the last option: use a formula to determine which cells to format.
  • Enter the formula =EXACT(E6,”Yellow”).
  • Choose the format of your choice, which will appear when some cell fulfill the condition.
  • Click OK.
HIGHLIGHTING A CELL CONTAINING A SPECIFIC WORD

For the concept OF CONDITIONAL FORMATTING CLICK HERE.

EXAMPLE 3: STEPS TO  HIGHLIGHT THE CELLS IF TEXT CONTAIN A SPECIFIC CHARACTER

Suppose we want to create a condition when we want to highlight the cell if the cell contains any specific character say # for our example.GENERALIZED FORMULA TO HIGHLIGHT THE CELLS WHICH CONTAIN A SPECIFIC CHARACTER

  • Select the complete table.
  • Go to HOME TAB>CONDITIONAL FORMATTING>NEW RULE.
  • A dialog box as shown in the picture below will open.
  • Click the last option: use a formula to determine which cells to format.

UPDATE 1

For the concept of CONDITIONAL FORMATTING CLICK HERE.

EXAMPLE 4: HIGHLIGHT THE TYPE OF OBJECT AS SELECTED FROM A DROPDOWN LIST

This situation can come across frequently when we need to highlight some specific category of items or objects. NOTE: ONE POINT HERE IS WORTH MENTIONING THAT WE MAKE USE OF CONDITIONAL FORMATTING MOSTLY WHEN OUR DATA IS MIXED. IF THE DATA IS ALREADY ORGANIZED WHY WOULD WE NEED TO HIGHLIGHT IT. Let us try to create a list where we can highlight the countries lying in a particular continent by selecting the continent from a drop down list.Something like, shown in the picture below.

INTENDED EXAMPLE OUTPUT

SOLUTION:

This problem comprises of different steps for the solution. Here is the list. 

1. Creating a dropdown with continent names as the dropdown options.

2. Setting the CONDITIONAL FORMATTING rule for the given data to highlight the cells containing the countries of the selected continent.

3. Setting the format for the highlighted cells. 

STEP 1:

CREATING A DROPDOWN LIST FOR CONTINENTS LIST

Follow the steps to create a dropdown list.

[ THE COMPLETE DETAILS OF CREATING A DROPDOWN ARE HERE ]

  • Create a simple list of the continents which will be used as the source for the dropdown.
  • The list can be on the same sheet or other sheet as per the convenience.
  • Create a LABEL as SELECT THE CONTINENT .
  • Next to the LABEL select the cell, where we’ll populate our dropdown list.
  • Go to DATA TAB > DATA VALIDATION DROPDOWN > DATA VALIDATION
  • A dialog box will open as shown below.
  • Select LIST from the ALLOW DROP DOWN as shown in the first picture.
  • After choosing the LIST OPTION , select the source as the range containing the continents. We can directly enter the range or can choose it using the mouse.
  • After choosing the source, we can directly click OK to close the dialog box or we can choose the tab INPUT MESSAGE and choose the INPUT MESSAGE as SELECT THE CONTINENT TO HIGHLIGHT THE COUTRIES as shown in the last picture.
  • Click OK.
STEPS FOR CREATING DROPDOWN LIST

After clicking OK, the dropdown list has been inserted in the cell.

STEP 2: CREATING CONDITIONAL FORMATTING RULES TO HIGHLIGHT THE COUNTRIES OF THE SELECTED CONTINENT

FOLLOW THE STEPS TO ADD CONDITIONAL FORMATTING RULES

  • Select the data excluding the headers.
SELECT THE DATA EXCLUDING THE HEADERS
  • Go to HOME TAB > CONDITIONAL FORMATTING DROP DOWN > NEW RULE.
GO TO HOME TAB > CONDITIONAL FORMATTING > NEW RULE
  • As we click NEW FORMATTING RULE , the dialog box will open.
  • Choose the last option – USE A FORMULA TO DETERMINE WHICH CELLS TO FORMAT.
  • Enter the formula as =$D$5=$F6. [D5 contains our selected continent and F6 is the first cell of the selection. $ has been applied to make the reference absolute for the selection as we don’t want to the selection to go relative whereas the F6, we want the column to be fixed so apply $ before F. [ Learn Conditional Formatting for details ]
  • After entering the formula, click FORMAT BUTTON as shown in the picture below.
ENTER THE FORMULA AND GO FOR FORMAT SETTING
  • As we click the format button, a FORMAT CELLS DIALOG BOX opens up.
  • Choose the format as per your choice.
  • We went for FILL TAB > FILL EFFECTS > AND CHOSE AN EFFECT AS SHOWN IN THE PICTURE BELOW.
  • You can choose the format of your own. This format will be visible in all the cells which satisfy our rule we entered.
SET THE FORMAT AS REQUIRED
  • Click OK.
  • We are done.
FINAL OUTPUT

CHECKING THE OUTPUT:

We can check the example by selecting the continent from the dropdown.

RUNNING EXAMPLE

ONE MORE EXAMPLE FOR CONTROLLING THE CONDITIONAL FORMATTING WITH THE TEXT OR NUMBERS AT OTHER POSITION IS HERE.

CREATING A SIMPLE GANTT CHART IN GOOGLE SHEETS

ALTHOUGH, THE ARTICLE SHOWS THE USAGE OF CONDITIONAL FORMATTING IN GOOGLE SHEETS, BUT IT IS COMPLETELY UNDERSTANDABLE AND WORTH READING. TAKE A LOOK AT MORE EXCEL TRICKS. YOU MAY FIND SOMETHING INTERESTING. 

EXCEL TRICKS EXPLAINED

THERE’S ALWAYS ROOM FOR IMPROVEMENT.

KINDLY GIVE YOUR VALUABLE SUGGESTIONS.