Your requirement based on your description according to my understanding is:
High >=2 --> High
High <2 & Medium >=4 --> Medium
However, I cannot understand why “if only 2 categories are marked medium it is Low”.
As you have 8 choice columns, it should be
High <2 & Medium < 4 --> Low
To achieve that, an easier method is use some calculated columns with IF function to find out how many times particular text occurs in these choice columns.
- Create a calculated column named “NumberOfHigh”.
use the following formula:
=IF([column1]="High",1,0)+IF([column2]="High",1,0)+….
Save the column. After that, you will get the number of “High” values.
- Repeat the 1-3 steps to count the “Medium” and “Low” values.
Create a calculated column with the formula below, to get the “High”, “Medium” or “Low” result.
=IF([NumberOfHigh]>=2, "High", IF([Medium]>=4, "Medium", "Low"))
Without using the calculated column, you need to use JSOM to retrieve list item and check these choice columns values of the item and count the number of “High”, “Medium” and “Low”. Set the column based on the number of “High”, “Medium” and “Low”.
Demo of retrieving list items:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js Jump "></script>
<script>
$(function () {
ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "sp.js");
});
function retrieveListItems() {
var clientContext = new SP.ClientContext();
var oList = clientContext.get_web().get_lists().getByTitle('<list>');
var camlQuery = new SP.CamlQuery();
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}
function onQuerySucceeded(sender, args) {
var listItemInfo = '';
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += 'ID: ' + oListItem.get_id() +
'Title: ' + oListItem.get_item('Title');
}
console.log(listItemInfo);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
</script>
Refer to:
SharePoint Online: Retrieve list items from SharePoint list using JavaScript Object Model (JSOM)
How to: Create, Update, and Delete List Items Using JavaScript