Forum Discussion
NicosAcuna
Mar 02, 2021Copper Contributor
Automatically assigning a value based on another column value
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.
- RobElliottSilver Contributor
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.
Rob
Los Gallardos
Microsoft Power Automate Community Super User- HugoVitalCopper Contributor
RobElliott I have a list grouped by State and I want to add a Solution ID column that I want to populate a unique ID based on the state selected. This does not seem to be working for me. How can I accomplish? All states have a unique ID # that is 15 numbers long. =IF(State=“AL”,201028145313666,IF(State=“AK”,201028145313777,”)
- Rob_ElliottBronze Contributor
HugoVital I assume by "Solution ID column" you mean a calculated column. You need to use a formula like this:
=IF(State="AL","201028145313666",IF(State="AK","201028145313777",IF(State="AZ","196745986234901","0")))Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
- Awesome390Copper ContributorThis doesn't work for me I get an error:
Sorry, something went wrong
One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas.
One column is choice, the other column is my calculated column which puts the text I want. - Cuba_RJCopper Contributor
Hi, RobElliott
I have the same problem in this post, but if I have any change in the number of departments or even names I would have to return to this formula and adjust, am I right?
Is there any other solution that would handle variables for Departments?- Rob_ElliottBronze Contributor
Cuba_RJ yes you would have to update it manually, it wouldn't update dynamically.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)