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 ✭✭✭✭✭✭
  • Hello again there!! I had one follow up question. 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,

    对不起! !一个问题——如果我的时间窗口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\/108888\/is-it-possible-to-url-query-an-embedded-form\n <\/a>\n<\/div>\n

Hi,<\/p>

I hope you're well and safe!<\/p>

Unfortunately, as far as I know, it's not possible now (if you mean that the Query should be included in the URL to Dashboard, it's only possible in the URL to the form), but it's an excellent idea!<\/p>

Please submit this as a Product Feedback or Idea <\/strong>(If it hasn't been added already)<\/em><\/strong> when you have a moment.<\/strong><\/a><\/p>

How would you like to use it? What's the use case?<\/p>

I hope that helps!<\/p>

Be safe, and have a fantastic weekend!<\/p>

Best,<\/p>

Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p>

Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/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":204,"urlcode":"Forms","name":"Forms"},{"tagID":254,"urlcode":"Formulas","name":"Formulas"},{"tagID":292,"urlcode":"Dashboards","name":"Dashboards"},{"tagID":530,"urlcode":"url","name":"URL"}]},{"discussionID":108886,"type":"question","name":"Why does a user show an email address?","excerpt":"When I'm adding users to Assigned, it usually shows the First Name Last Name, but sometimes it just shows the email address. How do I fix this? See screenshot example.","snippet":"When I'm adding users to Assigned, it usually shows the First Name Last Name, but sometimes it just shows the email address. How do I fix this? See screenshot example.","categoryID":321,"dateInserted":"2023-08-12T18:59:03+00:00","dateUpdated":null,"dateLastComment":"2023-08-12T20:33:33+00:00","insertUserID":128842,"insertUser":{"userID":128842,"name":"Karen Bruer","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Karen%20Bruer","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!5MPAuTrWZX4!elHDp9qhGX4!HMSKFvshvfI","dateLastActive":"2023-08-13T15:19:32+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭"},"updateUserID":null,"lastUserID":161632,"lastUser":{"userID":161632,"name":"SteyJ","title":"Jacob Stey","url":"https:\/\/community.smartsheet.com\/profile\/SteyJ","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!5Zjq-V_rc4o!zmkrczO71bo!6kwXWfi9FUH","dateLastActive":"2023-08-13T15:59:45+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":1,"countViews":21,"score":null,"hot":3383739756,"url":"https:\/\/community.smartsheet.com\/discussion\/108886\/why-does-a-user-show-an-email-address","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108886\/why-does-a-user-show-an-email-address","format":"Rich","lastPost":{"discussionID":108886,"commentID":390375,"name":"Re: Why does a user show an email address?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390375#Comment_390375","dateInserted":"2023-08-12T20:33:33+00:00","insertUserID":161632,"insertUser":{"userID":161632,"name":"SteyJ","title":"Jacob Stey","url":"https:\/\/community.smartsheet.com\/profile\/SteyJ","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!5Zjq-V_rc4o!zmkrczO71bo!6kwXWfi9FUH","dateLastActive":"2023-08-13T15:59:45+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\/I85D28MOQEGC\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-13T15:20:11+00:00","dateAnswered":"2023-08-12T20:33:33+00:00","acceptedAnswers":[{"commentID":390375,"body":"

\n \n https:\/\/community.smartsheet.com\/discussion\/108886\/why-does-a-user-show-an-email-address\n <\/a>\n<\/div>\n

You can have them update their contact card by going to Settings -> Personal Settings<\/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":108879,"type":"question","name":"Not all recipients are receiving automated emails","excerpt":"Hello. I have many sheets with automation and i have one that is giving me an issue. I am getting the above email notice from smartsheets for this one automation on one sheet. I have double checked that the restrictions are set to \"Unrestricted\". See attachments. Thank you! Any ideas what is happening or how to fix it?","snippet":"Hello. I have many sheets with automation and i have one that is giving me an issue. I am getting the above email notice from smartsheets for this one automation on one sheet. I…","categoryID":321,"dateInserted":"2023-08-11T22:17:59+00:00","dateUpdated":null,"dateLastComment":"2023-08-12T15:59:01+00:00","insertUserID":165014,"insertUser":{"userID":165014,"name":"David Sprague","title":"Fire Chief","url":"https:\/\/community.smartsheet.com\/profile\/David%20Sprague","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-12T22:17:23+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-08-13T15:40:14+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":36,"score":null,"hot":3383650020,"url":"https:\/\/community.smartsheet.com\/discussion\/108879\/not-all-recipients-are-receiving-automated-emails","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108879\/not-all-recipients-are-receiving-automated-emails","format":"Rich","lastPost":{"discussionID":108879,"commentID":390368,"name":"Re: Not all recipients are receiving automated emails","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390368#Comment_390368","dateInserted":"2023-08-12T15:59:01+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-08-13T15:40:14+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-12T22:18:07+00:00","dateAnswered":"2023-08-12T15:04:58+00:00","acceptedAnswers":[{"commentID":390360,"body":"

Hi @David Sprague<\/a>, <\/p>

I hope you're well and safe!<\/p>

There's a known issue at the moment.<\/p>

I'll get back to the post if I can find the thread.<\/p>

I hope that helps!<\/p>

Be safe, and have a fantastic weekend!<\/p>

Best,<\/p>

Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p>

Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/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":[]}],"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":4943,"limit":3},"title":"Trending in Smartsheet Basics","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Smartsheet Basics