Formula Calculation with a zero value denominator
I'm trying to create a formula to calculate the # Hours per remaining week based off the total HOURS remaining. Calculation takes into consideration the calculated remaining # of weeks on a project. Logic should be: Take Remaining hours / # of remaining weeks. If remaining weeks is < 1, simply return the amount of remaining hours.
The current formula below I have is calculating correctly when the Remaining (Weeks) is 1 or more. However, once the Remaining (Weeks) is less than 1, the returned value is incorrect and I cannot figure out WHY it returns this odd 1125 value.
Formula: =IF([Column2]9 > 0, [Column3]@row / [Column2]9, MAX([Column3]@row, 0))
In this example, # of remaining weeks is 3.3. Therefore, the Remaining Per Week is 97.8 (321.5/3.3)-> Correct calculation
Second Example: Here, using the same formula but when the Remaining (Weeks) is < 1, it keeps returning a value of "1125" which I cannot figure out why. What I want it to return is the Remaining Hours of = 321.5 - the value in[email protected]Tried writing this in different ways, and keep getting same odd value. Any idea and help would be great appreciated. Thank you
Best Answer
-
Nick Korna ✭✭✭✭✭
It's down to your formula and rounding. What's happening is that you have 0.3 of a week (which I'm guessing is actually 2 days - 0.2857..., rounded to 0.3). If you calculate 321.5/(2/7), you end up with the 1125.3 (to 1 dp).
You can get round this by altering your formula to do what you're actually after:
=IF([Column2]9 >= 1, [Column3]@row / [Column2]9, MAX([Column3]@row, 0))
This should make it so if weeks remaining is equal to or greater than 1 it will do the calculation, and otherwise take the MAX of either 0 or column 3.
Give this a try and hopefully it should resolve your issue!
Answers
-
Nick Korna ✭✭✭✭✭
It's down to your formula and rounding. What's happening is that you have 0.3 of a week (which I'm guessing is actually 2 days - 0.2857..., rounded to 0.3). If you calculate 321.5/(2/7), you end up with the 1125.3 (to 1 dp).
You can get round this by altering your formula to do what you're actually after:
=IF([Column2]9 >= 1, [Column3]@row / [Column2]9, MAX([Column3]@row, 0))
This should make it so if weeks remaining is equal to or greater than 1 it will do the calculation, and otherwise take the MAX of either 0 or column 3.
Give this a try and hopefully it should resolve your issue!
-
克里斯汀·曹 ✭
@Nick KornaI didn't think about how the system calculated the partial week. However, your suggested formula worked!! Thank you so very much. This community is awesome! Cheers - Christine
Help Article Resources
Categories
=JOIN(COLLECT([Dash Columns]12:[Dash Columns]61, [Dash Columns]12:[Dash Columns]61, @cell <> \"//www.santa-greenland.com/community/discussion/106528/\"), \", \")<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]},{"discussionID":106627,"type":"question","name":"Automated due date for every Monday","excerpt":"I have several reports that I run. I have a SmartSheet that lists how often it runs (Daily, weekly or monthly). I have an equation that calculates the next due date based on the completion date. The completion date is automatically recorded when I complete the report. It works beautifully except for the times that weekly…","categoryID":322,"dateInserted":"2023-06-20T12:08:03+00:00","dateUpdated":null,"dateLastComment":"2023-06-20T13:15:59+00:00","insertUserID":120783,"insertUser":{"userID":120783,"name":"Lisa Vercellone","url":"https:\/\/community.smartsheet.com\/profile\/Lisa%20Vercellone","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-20T16:08:37+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":120783,"lastUser":{"userID":120783,"name":"Lisa Vercellone","url":"https:\/\/community.smartsheet.com\/profile\/Lisa%20Vercellone","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-20T16:08:37+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":24,"score":null,"hot":3374531042,"url":"https:\/\/community.smartsheet.com\/discussion\/106627\/automated-due-date-for-every-monday","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106627\/automated-due-date-for-every-monday","format":"Rich","lastPost":{"discussionID":106627,"commentID":381284,"name":"Re: Automated due date for every Monday","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381284#Comment_381284","dateInserted":"2023-06-20T13:15:59+00:00","insertUserID":120783,"insertUser":{"userID":120783,"name":"Lisa Vercellone","url":"https:\/\/community.smartsheet.com\/profile\/Lisa%20Vercellone","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-20T16:08:37+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/7LJZYGRS3588\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-20T13:17:21+00:00","dateAnswered":"2023-06-20T12:22:38+00:00","acceptedAnswers":[{"commentID":381263,"body":"
Incorporate the below into your formula it will give you the Monday following the last completed date.<\/p>
=[Completed Date]@row - (WEEKDAY([Completed Date]@row) - 2)+7<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":106620,"type":"question","name":"Need empty column blank","excerpt":"I want to use a formula like this below but if there is no date in the other column to add +14 to, then leave row blank. =([CONFIRM OW PHOTO DUE]@row + 14) Need the \"14\" left blank","categoryID":322,"dateInserted":"2023-06-20T00:19:06+00:00","dateUpdated":null,"dateLastComment":"2023-06-20T14:11:32+00:00","insertUserID":162246,"insertUser":{"userID":162246,"name":"Shawn_K2","url":"https:\/\/community.smartsheet.com\/profile\/Shawn_K2","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!nPFlXyflhuI!uj8vZ9JIm_o!1axowkoO9t8","dateLastActive":"2023-06-20T14:32:08+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-06-20T15:01:55+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":6,"countViews":61,"score":null,"hot":3374494238,"url":"https:\/\/community.smartsheet.com\/discussion\/106620\/need-empty-column-blank","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106620\/need-empty-column-blank","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":106620,"commentID":381293,"name":"Re: Need empty column blank","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381293#Comment_381293","dateInserted":"2023-06-20T14:11:32+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-06-20T15:01:55+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/BW38GVCJFDPD\/2023-06-19-20-16-43-creative-ops-comprehensive-content-tracker-smartsheet-com.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"2023-06-19 20_16_43-Creative Ops - Comprehensive Content Tracker - Smartsheet.com.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-20T13:11:28+00:00","dateAnswered":"2023-06-20T12:13:43+00:00","acceptedAnswers":[{"commentID":381259,"body":"
=If([Confirm OW Photo Due]@row=\"//www.santa-greenland.com/community/discussion/106528/\",\"//www.santa-greenland.com/community/discussion/106528/\",[Confirm OW Photo Due]@row+14)<\/p>"},{"commentID":381278,"body":"