Apply SharePoint Row Colors Based on People Column Counts
Question details
The user wants to conditionally change the background color of SharePoint list rows or cells depending on the number of users selected in a multi-select People and Groups column.

- Product
- SharePoint
- Device & OS
- not provided
- Scenario
- Customizing a SharePoint list view to provide visual indicators based on how many users are assigned to an item, without utilizing Power Apps.
- Observed behavior
- The user needs to count the users in a People column to trigger background color changes (e.g., yellow for fewer than two users, green for two or more) using native SharePoint JSON formatting and Power Automate workflows.
Ensure you have list management permissions in SharePoint to format views and sufficient access to Power Automate to create and manage cloud flows.
Use Power Automate to Count Users and Apply JSON View Formatting
Since SharePoint JSON formatting cannot directly count array lengths, you can use a Power Automate flow to extract the user count into a helper column, and then base your JSON row formatting on that helper column.
SharePoint list formatting relies on the values directly available in the list view. A multi-select People and Groups column is treated as an array, but JSON view formatting does not have a built-in function to count the number of elements in an array. To solve this, you must calculate the count automatically via a flow and store it in a standard number column.
Navigate to your SharePoint list and add a new Number column (e.g., named 'PersonNumber'). This column will hold the count of the users selected.
Open Power Automate and create an automated cloud flow that triggers 'When an item is created or modified' targeting your SharePoint list.
Add an 'Update item' action. For the 'PersonNumber' field, use a flow expression like length(triggerOutputs()?['body/YourPeopleColumnName']) to calculate how many users are selected in the People column.
Return to your SharePoint list, click the view dropdown menu in the top right corner, select 'Format current view', and choose 'Advanced mode'.
Paste your custom JSON code to style the row. Use conditions based on the 'PersonNumber' column, setting the background color to yellow when the value is less than 2, and green when it is greater than or equal to 2. Save the view.

Boost Your Productivity with WPS Office
While you use SharePoint and Power Automate for complex web-based list management, WPS Office is the perfect solution for your daily desktop document needs. It provides a lightweight, fast, and feature-rich environment to manage documents, spreadsheets, and presentations.
- 1. Download the Installer: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install the Software: Run the installer and follow the quick on-screen setup instructions.
- 3. Open Your Files: Launch WPS Office and directly open your existing Microsoft Office documents without worrying about format conversion or data loss.

Frequently Asked Questions
Can I count people in a SharePoint column using only JSON formatting?
No, SharePoint JSON formatting does not currently have a function to evaluate the length or count of elements inside an array-type column, such as a multi-select People and Groups column. You must use a workaround like Power Automate to count the items first.
Do I need Power Apps to customize row colors in SharePoint?
No, Power Apps is not required for simple visual modifications. You can natively customize row and column colors using SharePoint's out-of-the-box JSON view formatting capabilities.
Why isn't my Power Automate flow updating the number column correctly?
Ensure your flow triggers on both item creation and modification. Also, verify that your length() expression correctly targets the internal name of the People column array and includes conditions to handle null values in case the column is left entirely blank.
Can I apply the color rules to just one cell instead of the whole row?
Yes. By choosing 'Format this column' from the column's dropdown menu instead of 'Format current view', you can apply your JSON conditional formatting strictly to the individual cell's background.




