1

Within a SharePoint Online list, if I have a record that has 6 columns like so...

ID: #id of this record
Title: "my first test" 
Step 1: "apple" 
Step 2: "grape"
Step 3:
Sum: 2

or in another way

ID: #id of this reord
Title: "my first test" 
Step 1: "apple" 
Step 2: "grape"
Step 3: "jelly"
Sum: 3

How can I have a column Sum: that prints the total number of other Step_x: columns that has a string value?

2 Answers 2

1

You can do this with a calculated column with a formula like:

=COUNTA([Step1], [Step2], [Step3])

Details here: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/bb862071(v=office.14)#count-nonblank-columns


Alternatively, you can do this with column formatting with a format like this:

{
  "elmType": "span",
  "txtContent": "=if([$Step1],1,0) + if([$Step2],1,0) + if([$Step3],1,0)"
}
1
  • 1
    Your first answer was good enough for my situation. Many thanks!
    – klewis
    Commented Mar 25, 2021 at 16:32
1

Use any one of the below formulas in your calculated column:

="Sum: " & COUNTA([Step 1], [Step 2], [Step 3])

OR

=CONCATENATE("Sum: ", COUNTA([Step 1], [Step 2], [Step 3]))

References:

  1. CONCATENATE function
  2. Count nonblank columns

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.