Forum Discussion
BShepard22
Feb 28, 2024Copper Contributor
How to pull from 'Person' field in one column to populate 'Department' of another
Hello all. Hoping someone can help me out with this.
I'm trying to set up a Microsoft list that has a person column (Column A) and a department column (coulmn B)
I would like to auto-populate column B with the deparment, by setting it up to look up and insert the department of the person selected in the 'A' column.
Column A is set up allow me to select names of people or groups within the organization and has the department data attached to the person, so I want to pull that department into a separate column once a name is selected.
Would anyone have any tips on how to do this?
3 Replies
Sort By
- EliseSharePointCopper ContributorYou might have already resolved this, but if you haven't, and your list doesn't have too many items, you can easily accomplish this with Classic Mode and Quick Edit.
- Display your list in Classic mode and include the filled in Column A and the empty Column B.
- Copy Column A and paste it into Column B just like you would do in Excel
- Exit Quick Edit
Column B should display whatever profile field you selected (Department in your case).
This only works in Classic mode - the new Lists experience and even Modern experience are broken. Both ignored the people picker field selection and displayed user name in Column B. BShepard22 If you are not going to use those department values later, for filtering/sorting, etc. (you don't need to "save" department in column) and you just want to show the department in SharePoint list view then you can achieve it using JSON column formatting:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "[$PersonGroupCol.department]" }
Where [$PersonGroupCol] is an internal name of your person column in SharePoint list in this format: [$InternalNameOfColumn]. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?
If you want to "save" the actual value in department column, you can create a Microsoft power automate flow to update the department field based on the Person or Group field OR
You can customize the list form using Power Apps to auto-populate department column using Office 365 Users connector and Power Apps formulas. Check: Customize a Microsoft Lists or SharePoint form by using Power Apps
Similar thread: Get Email from user and enter into SharePoint list field
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.
- BShepard22Copper ContributorI'm going to try the second option you mentioned. Thank you for this.