How to spread costs evenly across months, if they fall within those dates

I have various financial line items that span different dates. I'd like the costs to be spread per month automatically based on the date and cost entry.

I've tried various functions already, IF, AND, and it says Unpearsable.

I'd like to spread out the costs in the Cost column to the months on the right, based on the start and end date entered. Also, if a cost shows up in the month cell, I'd like the cell color to change (can do this with conditional formatting once the cost shows up).

Really appreciate the help!!


image.png


Best Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    You would use the below for Jan 2023 and adjust the month and year numbers accordingly for each of the other months.

    =IF(AND(MONTH([Start Date]@row)<= 1, YEAR([Start Date]@row)<= 2023, MONTH([End Date]@row)>= 1, YEAR([End Date]@row)>= 2023), [$ per month]@row)

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Lets try a different approach.

    =IF(AND(VALUE(YEAR([Start Date]@row) + IF(MONTH(Start Date]@row)< 10, "0", "") + MONTH([Start Date]@row))<=202307, VALUE(YEAR([End Date]@row) + IF(MONTH([End Date]@row)< 10, "0", "") + MONTH([End Date]@row))>=202307), [$ per month]@row)


    Basically we are creating a yyyymm stamp from the start and end dates and comparing them to the yyyymm stamp for that year/month combo. The above is for July 2023 (202307).

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓
«1

Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    There are already a number of threads out here in the Community detailing how to do this. I'll see if I can find some links for you.

  • Thanks Paul! Yeah I looked through a lot of those, but kept getting errors. Figured this set up was a bit different... Let me look again.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    我不能to find any of the posts even though I specifically remember helping someone with this exact thing just a few weeks ago.


    Are you overlapping into a new year in your sheet, or is it strictly 2023?

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    You would use the below for Jan 2023 and adjust the month and year numbers accordingly for each of the other months.

    =IF(AND(MONTH([Start Date]@row)<= 1, YEAR([Start Date]@row)<= 2023, MONTH([End Date]@row)>= 1, YEAR([End Date]@row)>= 2023), [$ per month]@row)

  • Worked perfectly!! THank you SOOOOO much!!! I spent too much time trying to get that formula right :)

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
  • 再次你好! !我有一个跟进的问题。This works perfectly in 2023, but when I move to 2024 columns and use months 1, 2, 3 etc and year 2024, data does not show up. Any reason that formula needs to be different?

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Lets try a different approach.

    =IF(AND(VALUE(YEAR([Start Date]@row) + IF(MONTH(Start Date]@row)< 10, "0", "") + MONTH([Start Date]@row))<=202307, VALUE(YEAR([End Date]@row) + IF(MONTH([End Date]@row)< 10, "0", "") + MONTH([End Date]@row))>=202307), [$ per month]@row)


    Basically we are creating a yyyymm stamp from the start and end dates and comparing them to the yyyymm stamp for that year/month combo. The above is for July 2023 (202307).

  • I think I know why, but dont know how to fix it. Let's say there's an activity that starts Jan 2023 and extends till Apr 2024. The cost is spreading as expected up to April 2023 and then stop, maybe because the formula is getting confused between Month 4 in 2023 and 2024. But I don't know how to fix it. Here are my formulae. If someone can tell me what I'm doing wrong, that would be really appreciated!


    Month months in 2023: =IF(AND(MONTH([Start Date]@row) <= 1, YEAR([Start Date]@row) <= 2023, MONTH([End Date]@row) >= 1, YEAR([End Date]@row) >= 2023), [$ per Month]@row)

    • I adjust to month 2 and 3 etc for 2023

    For 2024: IF(AND(MONTH([Start Date]@row) <= 1, YEAR([Start Date]@row) <= 2024, MONTH([End Date]@row) >= 1, YEAR([End Date]@row) >= 2024), [$ per Month]@row)


    The problem is, when the month numbers start overlapping (between 2023 and 2024, as in the row extends from say April 2023 to Jun 2023), then any months that repeat in both years dont get a value.


    Any ideas? THank you!!!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓
  • The updated formula you sent does seem to work for 2024! Thank you... these formulae just arent intuitive to me, though I do love to use Smartsheets!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
  • Hi Paul,

    Sorry!!! One more question - if my time window is say 4/1/23 to 7/15/23, it is splitting evenly over 4 months (making the total higher than the actual cost). In the month of July, the cost spread should only be 50%, of that month since the line item is only till Jul 15th. I added in $ per day as below.

    THis is my April formula below:

    =IF(AND(VALUE(YEAR([Start Date]@row) + IF(MONTH([Start Date]@row) < 10, "0", "") + MONTH([Start Date]@row)) <= 202304, VALUE(YEAR([End Date]@row) + IF(MONTH([End Date]@row) < 10, "0", "") + MONTH([End Date]@row)) >= 202304), [$ per Month]@row)

    I've tried a few different things to change that last "[$ per Month]@row" into total cost of number of days in that particular month, but everything is giving me an error.

    What do you suggest? THANK YOU! You're the best!!!

    image.png


  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    That definitely adds some complexity to it. Give this a try:

    =IF(VALUE(YEAR([Start Date]@row) + IF(MONTH([Start Date]@row) < 10, "0", "") + MONTH([Start Date]@row)) = 202304, ((DATE(YEAR([Start Date]@row) + IF(MONTH([Start Date]@row) = 12, 1, 0), MONTH([Start Date]@row) + IF(MONTH([Start Date]@row) = 12, -11, 1), 1) - 1) - [Start Date]@row) * [$ per day]@row, IF(VALUE(YEAR([End Date]@row) + IF(MONTH([End Date]@row) < 10, "0", "") + MONTH([End Date]@row)) = 202304, DAY([End Date]@row) * [$ per day]@row, IF(AND(VALUE(YEAR([Start Date]@row) + IF(MONTH([Start Date]@row) < 10, "0", "") + MONTH([Start Date]@row)) <= 202304, VALUE(YEAR([End Date]@row) + IF(MONTH([End Date]@row) < 10, "0", "") + MONTH([End Date]@row)) >= 202304), [$ per Month]@row)))

\n \n https:\/\/community.smartsheet.com\/discussion\/108880\/recover-a-row-that-was-accidentally-moved-then-deleted\n <\/a>\n<\/div>\n

Hey @GlennJo<\/a>,<\/p>

the sheet should be available in the owner of the sheet, deleted files. If it is specifically a row of data that was deleted, you can try checking the activity log to see if it shows the removed data there.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","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":108822,"type":"question","name":"Activity Log | Rows Deleted Filter","excerpt":"I've got a conundrum on my hands where a record has gone missing. In the Activity Log, I'm able to find the record of when it was created. However, there is nothing I'm seeing indicating that it was deleted (even though the Activity Log doesn't have a specific filter for this, I traced through the log for the past 11 days…","snippet":"I've got a conundrum on my hands where a record has gone missing. In the Activity Log, I'm able to find the record of when it was created. However, there is nothing I'm seeing…","categoryID":321,"dateInserted":"2023-08-10T21:46:08+00:00","dateUpdated":null,"dateLastComment":"2023-08-10T22:01:16+00:00","insertUserID":121055,"insertUser":{"userID":121055,"name":"Jake Gustafson","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Jake%20Gustafson","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!-lnW91tuGTw!bO9UmyNQSXQ!WUYBUm0HF6t","dateLastActive":"2023-08-11T20:29:49+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"updateUserID":null,"lastUserID":121055,"lastUser":{"userID":121055,"name":"Jake Gustafson","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Jake%20Gustafson","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!-lnW91tuGTw!bO9UmyNQSXQ!WUYBUm0HF6t","dateLastActive":"2023-08-11T20:29:49+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":37,"score":null,"hot":3383410044,"url":"https:\/\/community.smartsheet.com\/discussion\/108822\/activity-log-rows-deleted-filter","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108822\/activity-log-rows-deleted-filter","format":"Rich","tagIDs":[447],"lastPost":{"discussionID":108822,"commentID":390131,"name":"Re: Activity Log | Rows Deleted Filter","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390131#Comment_390131","dateInserted":"2023-08-10T22:01:16+00:00","insertUserID":121055,"insertUser":{"userID":121055,"name":"Jake Gustafson","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Jake%20Gustafson","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!-lnW91tuGTw!bO9UmyNQSXQ!WUYBUm0HF6t","dateLastActive":"2023-08-11T20:29:49+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/SIFFD1TSN3Q6\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-10T22:01:20+00:00","dateAnswered":"2023-08-10T22:01:16+00:00","acceptedAnswers":[{"commentID":390131,"body":"

Ok, I found it. Classic case of submit something for help, then find the answer. I think what may have happened previously, is that I turned on all the filters, but since there isn't one for a Deleted Row, maybe the Deleted Row was hidden. When I came back, I didn't click anything on the filters for the Activity Log and when scrolling through looking for the 'magic' delete word, I found the record I was looking for.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","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":447,"urlcode":"activity-log","name":"Activity Log"}]},{"discussionID":108801,"type":"question","name":"Adding users to our account if they are already licensed on another account","excerpt":"Hiya, Couldn't find an answer to my exact question, so hoping someone can help. I am working with an external client to my company, and need to add them to our account on paid licenses. 1) Can I add them to our account if they have a different email address to our company? 2) If they already have an existing licensed…","snippet":"Hiya, Couldn't find an answer to my exact question, so hoping someone can help. I am working with an external client to my company, and need to add them to our account on paid…","categoryID":321,"dateInserted":"2023-08-10T16:26:57+00:00","dateUpdated":null,"dateLastComment":"2023-08-10T17:22:07+00:00","insertUserID":128877,"insertUser":{"userID":128877,"name":"Holly Benjamin","url":"https:\/\/community.smartsheet.com\/profile\/Holly%20Benjamin","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-10T17:23:19+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-11T20:31:01+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":1,"countViews":29,"score":null,"hot":3383373544,"url":"https:\/\/community.smartsheet.com\/discussion\/108801\/adding-users-to-our-account-if-they-are-already-licensed-on-another-account","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108801\/adding-users-to-our-account-if-they-are-already-licensed-on-another-account","format":"Rich","tagIDs":[543],"lastPost":{"discussionID":108801,"commentID":390085,"name":"Re: Adding users to our account if they are already licensed on another account","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390085#Comment_390085","dateInserted":"2023-08-10T17:22:07+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-11T20:31:01+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-10T17:23:30+00:00","dateAnswered":"2023-08-10T17:22:07+00:00","acceptedAnswers":[{"commentID":390085,"body":"

They can be added if they use a different domain.<\/p>


<\/p>

If they are licensed on another account, they would need to either be first removed from that account (can cause some logistical headaches) or added as an unlicensed user on your account.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","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":543,"urlcode":"licensed-users","name":"licensed users"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=321&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":4940,"limit":3},"title":"Trending in Smartsheet Basics","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Smartsheet Basics