Taming the Elusive “Calculated Column” – Logic – Part 10
Our Final List
In SharePoint create a list called “Employee Paychecks”.

Create a column called “Employee”, make it a “Choice” type and add in the two choices of “Yes” and “No” as “Radio Buttons”.

NOTE – I chose the “Choice” column rather than the “Yes/No” checkbox option because the “Yes/No” type doesn’t have a clear display as to what it really is (it doesn’t actually display the text “Yes” or “No” and can be confusing). Using a “Choice” type instead, will clearly display just what the column is for and will make it more readable for the users.
Create three additional columns for the 3 types of hours all in the same fashion as the “Employee” column (“Choice” type, “Yes” “No” choices, “Radio Buttons”).
Column titles: “Regular Hours”, “Vacation”, “Sick Leave”

Since we’re using “Choice” columns in our list, we’ll need to add in a little bit more to our formula in order to test for the values that they’ll be returning.
Formula so far:
=IF(AND([Employee], OR([Regular Hours],[Vacation],[Sick Leave])),"Issue Paycheck","Do Not Issue Paycheck")
Change to:
=IF(AND([Employee]="Yes",OR([Regular Hours]="Yes",[Vacation]="Yes",[Sick Leave]="Yes")),"Issue Paycheck","Do Not Issue Paycheck")
This will allow us to check the return “text” value of each column to see if it’s either “Yes” or “No”.
Create our final column called “Issue Paycheck” make it a “Calculated” type with a return type of “Text” and enter in the modified formula.
=IF(AND([Employee]="Yes",OR([Regular Hours]="Yes",[Vacation]="Yes",[Sick Leave]="Yes")),"Issue Paycheck","Do Not Issue Paycheck")

Once you have all columns created, enter in a series of items on the list using the same combinations of values from the “Truth Table”.

NOTE – I’ve also added in a couple extra items to show that it will handle empty values as well (since empty does not equal “Yes”, the result will be false).
Conclusion
If we had taken the same direction as in the previous series (detailing the “IF”) to test for each possible combination of values with multiple nested “IF” functions, the formula would have been considerable longer, and would have worked, but would have been much less efficient.
By using the “OR” and “AND” functions to test for combinations of values at the same time, we’ve not only lessened the development time need to create the formula, we’ve also made debugging and testing much easier (always a good thing).
Also, for those that may be wondering why we didn’t just use a single “Choice” column to house each of the options for hours, the reason is because SharePoint cannot handle “Multiple Select” values. Since there isn’t an “Array” function to deal with dynamic data types (those that aren’t consistent in length), a calculated column will not be able to reference a column that (can) return more than a single value. We could use a single Choice column, but it would defeat the logic we’re trying to accomplish since the calculation wouldn’t be able to see “more than one” choice…it would only see one.
Till next time…
- Dessie
Dessie Lunsford
Points-of-Sharing
- Taming the Elusive "Calculated Column"
- EndUserSharePoint.com: Taming the Elusive "Calculated Column" - Customizing a Task List
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” - Customizing a Task List (Part II)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” - Customizing a Task List (Part III)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” - Customizing a Task List (Part IV)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” - Text and Data
- EndUserSharePoint.com: Taming the Elusive "Calculated Column" - Customizing a Contacts List (Part I)
- EndUserSharePoint.com: Taming the Elusive "Calculated Column" - Customizing a Contacts List (Part II-I)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” - Customizing a Contacts List (Part II-II)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” - Customizing a Contacts List (Part II-III)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” – Text and Data (Part III)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” – Text and Data (Part IV)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” – Text and Data (Part V)
- EndUserSharePoint.com: Taming the Elusive “Calculated Column” – Text and Data (Part VI)
- Taming the Elusive “Calculated Column” – Lookup and Reference
- Taming the Elusive “Calculated Column” - Logic
- Taming the Elusive “Calculated Column” - Logic - Part 1
- Taming the Elusive “Calculated Column” - Logic - Part 2
- Taming the Elusive “Calculated Column” - Logic - Part 3
- Taming the Elusive “Calculated Column” - Logic - Part 4
- Taming the Elusive “Calculated Column” - Logic - Part 5
- Taming the Elusive “Calculated Column” - Logic - Part 7
- Taming the Elusive “Calculated Column” - Logic - Part 6
- Taming the Elusive “Calculated Column” - Logic - Part 8
- Taming the Elusive “Calculated Column” - Logic - Part 9
- Taming the Elusive “Calculated Column” - Logic - Part 10
- Taming the Elusive “Calculated Column” - Date and Time - Part 1
- Taming the Elusive “Calculated Column” - Date and Time - Part 2
- Taming the Elusive “Calculated Column” - Date and Time - Part 3
- Taming the Elusive “Calculated Column” - Date and Time - Part 4
- Taming the Elusive “Calculated Column” - Referencing Multiple Lines of Text Column
- Taming the Elusive “Calculated Column” – Date and Time – Part 5
- Taming the Elusive “Calculated Column” – Date and Time – Part 6
- Taming the Elusive “Calculated Column” – Date and Time – Part 7
- Taming the Elusive "Calculated Column" - Referencing a Multiple Lines of Text Column With Append Text: Part 1
- Taming the Elusive "Calculated Column" - Referencing a Multiple Lines of Text Column With Append Text: Part 2
- Taming the Elusive "Calculated Column" - Referencing a Multiple Lines of Text Column With Append Text: Part 3
Hi,
I have a multiple choice column. However I wish to use its selected values as concatenated text in another calculated column. Since neither lookups, nor multiple choice columns are allowed in calculated fields. How do I achive it? Please help!!!
1/ get concatenated text of all the selected choices.
2) use this concatenated text in a calculated column to appear alongside another column (as concatenated string)
Himani,
Actually, you can use a choice column without problems as long as its a dropdown or radiobutton list. The only time it wont be available to use in a calulation is if its set for “checkbox” (multiple responses).
The reason why is because a calculated column can only reference data that has a consistant or “single” possible result.
Once you introduce the possibility of more than one answer for a field, you cant use it in a calculated column.
With that being said, all you’d need to do is grab the value from the choice column and concatenate it with your other value using standard formulas.
- Dessie
How do i count the number of times the list has been viewed by the user.
Hi Dessie
Merry Xmas and Happy New Year to you.
I have noticed that the Stump the Panel is no longer in use.
One thing I was looking for that I thought was there, was the formula you did for calculating the days between two fields while taking into account the weekends.
Do you still have this formula kicking around?
Iain
Iain,
Happy holidays back at ya!!
STP is currently being worked on by Mark, and should hopefully be back soon.
I’ll dig around and see if I have that formula still (I should) and post it here for you.
- Dessie
Dessie,
Thanks for these posts they have been a great help. I’m wondering if the following can be done. I have about 100+ products in a drop down list. Whenever one of those products is picked I would like a value to populate in the calculated field, is that possible given the amount of choices in the drop down box?
For example If(drug=”a”,”renal”,if(drug=”b”,”bio”)) so on and so forth for 100+ products?
Thanks in advance to any insight you can provide.
Robert.\