Automatically assigning a value based on another column value

Occasional Visitor

Hello All,

 

I was wondering if there is a process in Sharepoint maybe using power automate that will help me fill a column automatically depending on another column value. 

 

As an example I have 26 Departments listed as possible choices in column A

I want Column B to auto generate a DepartmentID based on the department selected in column A

 

So every time HR (one of the 26 departments)  is selected in column A it will generate a "1" in column B.

Every TIme Operations is selected in column A it will auto populate a "2" in column B.

 

And so on and so fourth, my apologies if there is a simple solution, I'm quite new to using SharePoint and power apps.

2 Replies

@NicosAcuna well you could do it with a Switch control in Power Automate as you would be just inside the 27 case limit, but it's more work than having a calculated column using multiple If expressions. So your department column would be a choice column then you'd add the following formula to your DeptID calculated column:

=If(Department="HR",1,If(Department="Operations",2,If(Department="Warehouse",3,"")))

etc etc.

calculatedColumnFormula.png

 

calculatedColumn.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott Thank you for this solution! I was able to get this to work finally! I ran into another issue however. Lets say the choice column was multiselect, meaning you could select multiple options. How would I go about adding the points up on the second column? 

 

Below is my example and error I'm getting: 

(I have three selectable options and gave them all 2 points each for a total of 6 points. Lets say I were to select "Multiple Users" and "20 Users," that should equal up to 4 points. If I selected all three options from the drop down menu, it would be 6 points. So I have two columns related to this. First column is "Collaboration" and second column is "CollaborationCalculated" which is a Calculated Field. When I add this formula below in the "CollaborationCalculated" column it works until I make the "Collaboration" column to Allow multiple selections. I get the below error which says: "unsupportedFieldTypeError." Is there an IF statement with addition involved to make this work?) 

 

=IF([Collaboration]="Multiple Users",2,

IF([Collaboration]="20 Users",2,

IF([Collaboration]="10 Users",2,"")))

 

SyedFaizuddin_0-1651726033643.png

SyedFaizuddin_1-1651726129980.png