You can find people asking online for formulas to work with using **the IF function**, where they want to use a specific cell color as the condition. Until the latest version of Excel, it is not directly possible. But still, there is some work around that. And with a little help from the Excel macros, you can easily perform such tasks. In this tutorial, we are going to see the extent of what you can do with cell value if the cell color is green or any other specific color in Microsoft Excel.

**Table of Contents**hide

## Download Practice Workbook

You can download the workbook used for the demonstration from the link below.

## Things You Can Do If Cell Color Is Green (or Any Other Color) in Excel

Before going through the kinds of stuff you can do if the cell color is green or any other color, you have to define a custom function with the help of name defining feature in Excel. No matter the operation you want to perform you need to do this beforehand. But if you have done it once and do multiple of the task listed below, creating the function once will be enough.

### 1. If Cell Color Is Green Then Set Cell Value

In the first section, we are going to set cell values if the cell color is green in this Excel dataset. From the dataset, we can see that our second and fifth entries are green. We want to associate â€śAbsentâ€ť with them and associate â€śPresentâ€ť with the rest.

Follow these steps to see how you can create the custom function in Excel and then set the cell value if the cell color is green or any other color.

**Steps to Define Custom Function:**

- First of all, go to the
**Formulas**tab on your ribbon. - Then select
**Name Manager**from the**Defined Names**

- As a result, the
**Name Manager**box will open up. Now click on**New**on top of the box.

- After that, in the
**New Name**box, write down a name for the function in the**Name**field, and in the**Refers to**field, write down the following.

`=GET.CELL(38,Sheet1!B5)`

- Finally, click on
**OK**. Now you will have the formula ready called**GreenCheck**that can be used for other purposes.

**Steps to Set Values:**

- If you want to find out the color code of the green or any other color you are having, just select cell
**C5**and write down the following formula.

`=GreenCheck`

- Then press
**Enter**and click and drag the fill handle to the end to find values for all.

So we can see the color code of the type of green in our dataset is 50. You can clear these values now.

- To get the desired values in our cells, select cell
**C5**now and write down the following formula.

`=IF(GreenCheck=50,"Absent","Present")`

- Then press
**Enter**.

- After that, select the cell again. Now click and drag the fill handle icon to the end of the list to replicate the formula for the rest of the cells.

This way, we can set different values if the cell color is green or any other color.

**Read More:** **Excel Formula to Change Text Color Based on Value (+ Bonus Methods)**

### 2. If Cell Color Is Green Then Modify Cell Value

Letâ€™s say there are values already associated with the cells. If you want to modify these values now, this section is can be helpful for you. Here are the steps you can follow to modify cell values in a dataset.

**Steps to Define Custom Function:**

- First of all, go to the
**Formulas**tab on your ribbon. - Then select
**Name Manager**from the**Defined Names**

- As a result, the
**Name Manager**box will open up. Now click on**New**on top of the box.

- After that, in the
**New Name**box, write down a name for the function in the**Name**field, and in the**Refers to**field, write down the following.

`=GET.CELL(38,Sheet1!B5)`

- Finally, click on
**OK**. Now you will have the formula ready called**GreenCheck**that can be used for other purposes.

**Steps to Modify Cell Values:**

- Now letâ€™s make a chart similar to the one in the previous section. For that, select cell
**C5**and write down the following formula.

`=IF(GreenCheck=50,"Absent","Present")`

- Then press
**Enter**.

- After that, select the cell again. Now click and drag the fill handle icon to the end of the list to replicate the formula for the rest of the cells.

- Now to modify these values, letâ€™s say, we want the third entry to be green too. For that, select cell
**B6**and go to the**Home**tab of your ribbon. - Then select
**Format Painter**from the**ClipboardÂ**group.

- Now click on cell
**B7**.

The value of cell **C7 **will now automatically change to â€śAbsentâ€ť.

**Read More:** **Excel Conditional Formatting Text Color (3 Easy Ways)**

### 3. If Cell Color Is Green Then Remove Cell Value

Now letâ€™s say there are values already set on the dataset and you want to remove the values based on color. This section will show you how to remove cell values if the cell color is green from an Excel spreadsheet. But first, you need the custom function.

**Steps to Define Custom Function:**

- First of all, go to the
**Formulas**tab on your ribbon. - Then select
**Name Manager**from the**Defined Names**

- As a result, the
**Name Manager**box will open up. Now click on**New**on top of the box.

- After that, in the
**New Name**box, write down a name for the function in the**Name**field, and in the**Refers to**field, write down the following.

`=GET.CELL(38,Sheet1!B5)`

- Finally, click on
**OK**. Now you will have the formula ready called**GreenCheck**that can be used for other purposes.

**Steps to Remove Cell Values:**

Letâ€™s say the dataset has values shown below.

To remove the values associated with the green cells follow these steps.

- First, select cell
**C5**and write down the formula.

`=IF(GreenCheck=50,"","Present")`

- Then press
**Enter**.

You may not see any changes yet depending on your dataset.

- Now select cell
**C5**again and click and drag the fill handle icon to the end to replicate the formula.

You can see from the figure that the cell values have been removed from the Excel spreadsheet if the cell color of the adjacent cell is green.

**Read More:** **Change Font Color Based on Value of Another Cell in Excel (2 Methods)**

**Similar Readings**

**Apply Conditional Formatting to the Overdue Dates in Excel (3 Ways)****Conditional Formatting with INDEX-MATCH in Excel (4 Easy Formulas)****Pivot Table Conditional Formatting Based on Another Column (8 Easy Ways)****Conditional Formatting on Text that Contains Multiple Words in Excel****How to Do Conditional Formatting with Multiple Criteria (11 Ways)**

### 4. If Cell Color Is Green Then Count Cells

In this section, we are going to count cells of specific colors. We are choosing green for the demonstration. Letâ€™s say the dataset is like this.

To count the number of cells filled with green or any color we need the help of **the COUNTIF function**. But first, we need to define the custom function.

**Steps to Define Custom Function:**

- First of all, go to the
**Formulas**tab on your ribbon. - Then select
**Name Manager**from the**Defined Names**

- As a result, the
**Name Manager**box will open up. Now click on**New**on top of the box.

- After that, in the
**New Name**box, write down a name for the function in the**Name**field, and in the**Refers to**field, write down the following.

`=GET.CELL(38,Sheet1!B5)`

- Finally, click on
**OK**. Now you will have the formula ready called**GreenCheck**that can be used for other purposes.

**Steps to Count Cells:**

- To count the green cells now, select cell
**C5**and write down the following formula.

`=GreenCheck`

- Then press
**Enter**.

- After that, select the cell again. Then click and drag the fill handle icon to the end of the column to fill the cells with the formula.

Now we have all the color codes of the adjacent cells in the dataset.

- Next, select cell
**C12**to enter the count of green cells.

`=COUNTIF(C5:C10,50)`

- Finally, press
**Enter**.

This way you can count cells in Excel if the cell color is green or any other specific color.

**Read More:** **Excel Formula to Color a Cell If the Value Follows a Condition**

### 5. If Cell Color Is Green Then Sum Cell Values

Now letâ€™s assume there are other values associated with the rows of the color-coded cells. For example, letâ€™s look at the following dataset.

<25>

The way these color code functions are set up, the color code column has to be on the right of the colored cells. Nevertheless, we need the help of **the SUMIF function** for this task.

Follow these steps to see how you can create the custom function and then find the sum of the values associated with green cells.

**Steps to Define Custom Function:**

- First of all, go to the
**Formulas**tab on your ribbon. - Then select
**Name Manager**from the**Defined Names**

- As a result, the
**Name Manager**box will open up. Now click on**New**on top of the box.

- After that, in the
**New Name**box, write down a name for the function in the**Name**field, and in the**Refers to**field, write down the following.

`=GET.CELL(38,Sheet1!B5)`

- Finally, click on
**OK**. Now you will have the formula ready called**GreenCheck**that can be used for other purposes.

**Steps to Sum Cell Values:**

- First, select cell
**C5**and write down the following formula.

`=GreenCheck`

- Then press
**Enter**.

- After that, select the cell again and click and drag the fill handle icon to the end of the list to replicate the formula.

- Next, select cell
**C12**and write down the formula.

`=SUMIF(C5:C10,50,D5:D10)`

- Finally, press
**Enter**.

This way you can calculate the sum of cell values if the adjacent cell is green or any other color.

**Read More:** **How to Sum in Excel If the Cell Color Is Red (4 Easy Methods)**

## Conclusion

This concludes the different operations we can perform if the cell color is different like green in Excel. Hopefully, you have grasped the idea of working with different cell colors and using custom functions to accomplish tasks in Microsoft Excel. I hope you found this guide helpful and informative. If you have any questions or suggestions, let us know in the comments below.

For more guides like this, visit **Exceldemy.com**.

**Related Articles**

**How to Apply Different Types of Conditional Formatting in Excel****If Cell Color Is Red Then Execute Different Functions in Excel****How to Make Yes Green and No Red in Excel (8 Examples)****How to Make Yes 1 and No 0 in Excel (2 Effective Methods)****Conditional Formatting If Cell is Not Blank****How to Find Highest Value in Excel Column (4 Methods)**