Lots of questions about dates
Asked by Chrystal McFarland:

I've put together a board to track my reading list for 2023, which is a really big step up from the spreadsheets I've used in the past, however, there's one thing I could do fairly easily on a spreadsheet that I can't seem to find the right way to ask the right questions to set this up on Trello.

I'll set a "due date" for my book. Sometimes this is an \*actual\* due date (like when I'm checking out a book from the library), but most of the time it's just the end of the month or year. There's already a field for this, moving on.

I've created a field for the page numbers/minutes of the book. (I count audiobooks as part of this, btw).

What I can do with the spreadsheet fairly easily is something that looks like this:

```
(Number of total [pages OR minutes] - Current location) / (Due date - Today's date)
```

What that translates to is, "Take the total number of pages/minutes remaining, divide that by the number of days between now and the due date. The result is the pages/minutes to get through today."

Due dates are set for all of these, but I'm at a loss for how to do the math functions (or if it's even possible). Can someone point me to a reference?


Answers:
author: Theodoro Reato
body: Hi Chrystal,

I believe I understood and was able to create this formula, with the help of some awesome teammates :)

You'll need to use Butler to create a Card button that's going to give you the number of pages you need to read to achieve your goals on a Custom Field.

This page can help you learn the basics of Butler: <https://support.atlassian.com/trello/docs/butler-overview/>

But this command is not basic so bear with me,

You need to have three Custom Fields before the rule, I called them:

* **Total number of pages**
* **Current Location**
* **Result**

##They are all number fields, this is important for our formula :)

The **Result** is the value we want to achieve, you can follow the instruction in this article to create the Custom Fields on your board: <https://support.atlassian.com/trello/docs/using-custom-fields/>

On the Automation panel, go to the **Card Button** page and create a new one:

![Screenshot 2023-01-24 at 12.29.36 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/236157i899D289EC2B79B3B/image-size/large?v=v2&px=999 "Screenshot 2023-01-24 at 12.29.36 PM.png")

After it, you'll need to choose a name for your Card Button, go to the **Fields** tab and use the second option "set custom field _____ to _____"

Choose the Custom field you want to insert the result of the formula, on this case we chose **Result**and paste the following command on the New Value:

```
(({{%Total number of pages}}-{{%Current location}})/({cardduedate~YYMMDD}-{date~YYMMDD}))
```

To create this command I used the following articles:

- <https://support.atlassian.com/trello/docs/arithmetic-and-formatting-in-date-variables/>

- <https://support.atlassian.com/trello/docs/working-with-custom-fields/#Custom-Field-arithmetic>

To sum up, to add the value of a Custom Field you need to use {{%___}} and to use a date inside a formula you need to first convert it to a number we made that with the syntax \~YYMMDD, then we used the { } with it as we're obligate while using a variables, and the ( ) to separate the formulas.

After setting the rule you need to have a due date and the Custom Fields **Total number of pages** and **Current location** filled out, click on the Butler button and it'll add the results to the **Result** Custom Field. You'll need to re-click it to update the date if needed.

![Screenshot 2023-01-24 at 12.43.20 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/236163i53E3BBBD5F4BA772/image-size/large?v=v2&px=999 "Screenshot 2023-01-24 at 12.43.20 PM.png")

comments: author: Chrystal McFarland
body: Worked perfectly! Thanks so much!