Forum Discussion
Kim Williams
Jul 12, 2023Brass Contributor
SharePoint Calculated Column to compare two Person fields
Is it possible to create a calculated column to compare Person Field A with Person Field B?
AdminAy
Jul 13, 2023Copper Contributor
Certainly it is! you can create a calculated column to compare two Person fields using a simple formula. Here's is a step-by-step guide:
1. Go to your SharePoint site and navigate to the list or library where you want to add the calculated column.
2. Click on the "Settings" gear icon and select "List Settings" or "Library Settings".
3. Under the "Columns" section, click on "Create column".
4. Give your calculated column a name and select the column type as "Calculated (calculation based on other columns)".
5. In the "Formula" section, enter the following formula:
=IF([Person Field A]=[Person Field B],"Equal","Not Equal")
Replace `[Person Field A]` and `[Person Field B]` with the actual column names you want to compare.
6. Choose "Single line of text" as the data type for your calculated column.
7. Click "OK" to save the calculated column.
After adding the calculated column, SharePoint will evaluate the formula for each item in the list or library. It will display "Equal" if Person Field A is equal to Person Field B, and "Not Equal" if they are different.
Feel free to adjust the formula based on your specific requirements.
1. Go to your SharePoint site and navigate to the list or library where you want to add the calculated column.
2. Click on the "Settings" gear icon and select "List Settings" or "Library Settings".
3. Under the "Columns" section, click on "Create column".
4. Give your calculated column a name and select the column type as "Calculated (calculation based on other columns)".
5. In the "Formula" section, enter the following formula:
=IF([Person Field A]=[Person Field B],"Equal","Not Equal")
Replace `[Person Field A]` and `[Person Field B]` with the actual column names you want to compare.
6. Choose "Single line of text" as the data type for your calculated column.
7. Click "OK" to save the calculated column.
After adding the calculated column, SharePoint will evaluate the formula for each item in the list or library. It will display "Equal" if Person Field A is equal to Person Field B, and "Not Equal" if they are different.
Feel free to adjust the formula based on your specific requirements.
Kim Williams
Jul 13, 2023Brass Contributor
AdminAy Those Person fields are not available to choose from to do the comparison and if I manually add them, it gives me this error, "One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas." Seems like I would need to copy those Person fields into a single line column and then compare.
- AdminAyJul 13, 2023Copper ContributorOk, but use a SharePoint workflow or a Power Automate flow to automatically copy the values from the Person fields to the corresponding single line of text columns whenever changes occur.
This will ensure that the text columns stay up-to-date with the Person field values.
Once the values are copied, then you can apply the formular