I would like to shade entire rows in Excel based on the value of one cell. For example say I have the rows below:

```
**File No**
1122
1122
1144
1155
1155
1155
1166
```

I would like the first two rows (where the value of the file # is 1122) to be shaded in color 1, the next row (where the value of the file # is 1144) to be shaded in color 2, the next 3 rows (where the value of the file # is 1155) to be shaded color 1, the next row (where the value of the file # is 1166) to be shaded color 2

This question is related to
`excel`

What you can do is create a new column over on the right side of your spreadsheet that you'll use to compute a value you can base your shading on.

Let's say your new column is column D, and the value you want to look at is in column A starting in row 2.

In cell D2 put: =MOD(IF(ROW()=2,0,IF(A2=A1,D1, D1+1)), 2)

Fill that down as far as you need, (then hide the column if you want).

Now highlight your entire data set - this selection of cells will be the ones that get shaded in the next step.

From the **Home** tab, click **Conditional Formatting**, then **New Rule**.

Select **Use a formula to determine which cells to format**.

In "Format values where this formula is true" put **=$D2=1**

Click the **Format** button, click the **Fill** tab, then choose the color you want to shade with.

Examples here:

- Python: Pandas pd.read_excel giving ImportError: Install xlrd >= 0.9.0 for Excel support
- Converting unix time into date-time via excel
- How to increment a letter N times per iteration and store in an array?
- 'Microsoft.ACE.OLEDB.16.0' provider is not registered on the local machine. (System.Data)
- How to import an Excel file into SQL Server?
- Copy filtered data to another sheet using VBA
- Better way to find last used row
- Could pandas use column as index?
- Check if a value is in an array or not with Excel VBA
- How to sort dates from Oldest to Newest in Excel?
- Creating an Array from a Range in VBA
- Excel: macro to export worksheet as CSV file without leaving my current Excel sheet
- VBA: Convert Text to Number
- EPPlus - Read Excel Table
- How to label scatterplot points by name?
- What's the difference between "end" and "exit sub" in VBA?
- Rename Excel Sheet with VBA Macro
- Extract Data from PDF and Add to Worksheet
- Quicker way to get all unique values of a column in VBA?
- Multiple conditions in an IF statement in Excel VBA
- How to find and replace with regex in excel
- Unprotect workbook without password
- Excel is not updating cells, options > formula > workbook calculation set to automatic
- Find row number of matching value
- If "0" then leave the cell blank
- Clear contents and formatting of an Excel cell with a single command
- Remove Duplicates from range of cells in excel vba
- Delete worksheet in Excel using VBA
- Get list of Excel files in a folder using VBA
- Excel doesn't update value unless I hit Enter
- Declare a variable as Decimal
- Parse XLSX with Node and create json
- Detect if a Form Control option button is selected in VBA
- Get length of array?
- Object of class stdClass could not be converted to string - laravel
- Java - Writing strings to a CSV file
- Quickest way to clear all sheet contents VBA
- VBA: Counting rows in a table (list object)
- Excel VBA If cell.Value =... then
- VBA Excel - Insert row below with same format including borders and frames
- excel - if cell is not blank, then do IF statement
- filter out multiple criteria using excel vba
- Referencing value in a closed Excel workbook using INDIRECT?
- Use Excel VBA to click on a button in Internet Explorer, when the button has no "name" associated
- IndexError: too many indices for array
- File name without extension name VBA
- (Excel) Conditional Formatting based on Adjacent Cell Value
- Easy way to export multiple data.frame to multiple Excel worksheets
- Using ExcelDataReader to read Excel data starting from a particular cell
- What are the RGB codes for the Conditional Formatting 'Styles' in Excel?
- [Move to Excel - Shading entire row based on change of value]