Forum Discussion
SharePoint Calculated Column to compare two Person fields
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.
- Kim WilliamsJul 13, 2023Brass Contributorganeshsanap My use case is if the person that has created the new document (Requestor) is the same person that is marked as the Reviewer, I want it to set my Status field to a specific value, if they are not the same person, then I want an Approver sent to the Reviewer. If I use the "Is Equal" JSON, can I use that value Not Equal or Equal in my flow?
- ganeshsanapJul 13, 2023MVP
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.