Jul 12 2023 04:39 PM
Is it possible to create a calculated column to compare Person Field A with Person Field B?
Jul 12 2023 06:13 PM
Jul 13 2023 05:00 AM
@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.
Jul 13 2023 05:19 AM
Jul 13 2023 06:10 AM
@Kim Williams It it not possible using SharePoint calculated columns as formulas will not support person fields.
What is the use case after comparing the person fields?
If you just want to show the text (equal/not equal) in your list view, you can use JSON formatting like:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if([$Person1.email] == [$Person2.email], 'Equal', 'Not Equal')",
"style": {
"font-weight": "bold",
"color": "=if([$Person1.email] == [$Person2.email], 'green', 'red')"
}
}
Where Person1 and Person2 are internal names of your person columns. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online
Output:
Documentation: SharePoint JSON column formatting
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Jul 13 2023 06:42 AM
Jul 13 2023 07:39 AM
@Kim Williams JSON formatting is used to just show the text in list view, it does not actually store any value in the list item level.
However, you can compare the person column values in flow as well using equals() operator.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.