How can I use Excel to check if all values in a given range are the same?

Excel is a powerful tool that can be used to efficiently process and analyze data. One useful feature of Excel is the ability to check if all values in a given range are the same. This can be done by using the “COUNTIF” function to count the number of cells in the range that contain the same value, and then comparing it to the total number of cells in the range. If the two numbers match, it indicates that all values in the range are the same. This feature can be particularly helpful when working with large datasets, as it allows for quick identification of any discrepancies or errors in the data. By utilizing this function, users can ensure the accuracy and consistency of their data in a simple and efficient manner.

Excel: Check if All Values are the Same


You can use the following formulas in Excel to check if all values in a specific range of cells are the same:

Formula 1: Check if All Values in One Range are the Same

=AND(EXACT(B2:E2, B2))

This particular formula checks if all cells in the range B2:E2 have the same value and returns either TRUE or FALSE.

Formula 2: Check if All Values Between Two Ranges are the Same

=AND(EXACT(B2:B5, C2:C5))

This particular formula checks if all cells in the range B2:B5 are equal to all corresponding cells in the range C2:C5 and returns either TRUE or FALSE.

The following examples show how to use each formula in practice.

Example 1: Check if All Values in One Range are the Same

Suppose we have the following dataset that shows the employee with the best performance at some company during each quarter of various years:

We can type the following formula into cell F2 to check if the employee name is the same in each cell in the range B2:E2:

=AND(EXACT(B2:E2, B2))

We can then click and drag this formula down to each remaining cell in column F:

Excel check if all values in a row are the same

Column F now displays TRUE or FALSE to indicate if the names in each row are all the same or not.

Example 2: Check if All Values Between Two Ranges are the Same

We can type the following formula into cell E2 to check if the employee name is the same each quarter between the two companies:

=AND(EXACT(B2:B5, C2:C5))

The following screenshot shows how to use this formula in practice:

Excel check if all values between two ranges are the same

Cell E2 returns TRUE since the names in each quarter for Company A match the names in each quarter for Company B.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

x