Multiple IFs combined with Countm formula
Greetings,
I'm currently attempting to write a formula to provide variable outputs based on a Countm function(column in my smartsheet that has multiple dropdown options).
What I'm looking to do is have a single formula that will take the result of a Countm on my "corporate objectives" and output a percentage. In the example below, I have 6 different objectives of which I've roughly defined logic for.
Basically, if the countm finds a single entry in corporate objectives the output is one, if there are two entries the output is .5 and so on all the way to six.
Note: Ideally if there are zero entries found from the countm the output is 0
Essentially it boils down to the following statements(which I'd like to combine):
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=1, "1", 0)
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=2, ".5", 0)
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=3, ".33", 0)
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=4, ".25", 0)
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=5, ".2", 0)
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=6, ".17", 0)
Is anyone aware of how I could combine this logic into a single formula?
Let me know what other info I could provide or questions I could answer.
Thanks
Answers
-
This would be a case of nested IF statements. To nest IF statements, you basically drop the second IF into the 3rd portion of the first IF. The third IF goes into the 3rd portion of the second IF. The fourth IF goes into the 3rd portion of the third IF, so on and so forth.
Basically, replace the 0 in the first with the second. Then replace the 0 in the second with the third. Replace the 0 in the third with the fourth, etc....
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=1, "1", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=2, ".5", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=3, ".33", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=4, ".25", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=5, ".2", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=6, ".17", 0)))))
-
Hey Paul,
Thanks for the help, I think I'm about half way there with this formula:
=IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=1), "1", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=2), ".5", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=3), ".33", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=4), ".25", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=5), ".2", IF(COUNTM([Corporate Objectives]:[Corporate Objectives]=6), ".17", 0)))))
Two challenges remain:
- The formula above returns "1" no matter what (countm function seems to be somewhat ignored)
- I'd like to apply this as a column formula, so is there a way to add an @row or @cell to each of those so I can have outputs per row in my spreadsheet?
Thanks!
-
My apologies. I just noticed that your COUNTM functions aren't closed out.
=IF(COUNTM([Column Name]:[Column Name]) = 1
You have:
=IF(COUNTM([Column Name]:[Column Name] = 1)
The closing parenthesis should be immediately after the range.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.3K Get Help
- 423 Global Discussions
- 221 Industry Talk
- 462 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 144 Just for fun
- 59 Community Job Board
- 463 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!