Commonly Used Formula Examples Permalink
This guide provides real-world formula examples to help you calculate costs, combine values, measure time, apply conditions, and organize task data in Quire. Each example demonstrates how formulas can turn raw task data into meaningful insights.
Cost Calculations
How do I calculate the total cost of a task including subtasks?
To calculate the total cost of a task and all its subtasks, you need two custom fields:
- Create a Cost custom field.
- Field type: Number
- Decimal places: 2
- Create a Total Cost custom field.
- Field type: Formula
- Enter the following formula:
SUM(subtasks.{Total Cost}, Cost)
This formula adds the task’s own cost to the total cost of all its subtasks.
Learn all the functions you can use in the Quire formulas.
Displaying Multiple Values in One Field
How do I display multiple task values in a single formula field?
You can use an array formula to display or calculate multiple values at once. An array is a collection of items such as tasks, numbers, or text values.
Example: Display specific tasks in one field
[#2, #23]
This returns the specified tasks as a list.
Tip: You can specify tasks with the task identifier #task_ID in your formula.
How do I perform calculations on multiple items using arrays?
Array formulas allow you to apply the same operation to multiple items simultaneously.
Example: Retrieve due dates for multiple tasks
[#2, #23].due
This is equivalent to:
[#2.due, #23.due]
Using arrays reduces repetition and improves formula readability.
Learn more about Quire’s array formulas that allows you to list out or do calculations to a collection of data.
Duration Calculations
How do I calculate task duration in days, hours, or minutes?
You can calculate the duration between two dates in different units.
Example: Calculate duration in days
(due - start).days
This returns the number of days between the start and due dates.
Note: The result is rounded up to the nearest whole number (the smallest integer greater than or equal to the actual value). For instance, a duration of one hour will be counted as one day.
How do I calculate more precise durations?
For more accurate results, you can adjust the formula.
Example: Convert hours to days
(due - start).hours / 24
Date Information Extraction
How do I retrieve specific information from start or due dates?
You can extract individual components from a date field, such as:
- Year
- Month
- Day
- Hour
- Minute
- Second
- Weekday
Example: Get the weekday of a due date
due.weekday
Note: The weekday value follows a numerical format where 1 = Monday, 2 = Tuesday, and so on.
Workday Calculations
How do I calculate the number of workdays between two dates?
Use the WORKDAYS function to calculate working days between two dates.
WORKDAYS(start, due)
If the start and due dates are the same, the result is 1 day.
How do I calculate workdays using today’s date?
Example:
WORKDAYS(<today>, <tomorrow>)
This returns 2 days.
How do I customize weekends in workday calculations?
You can define which days count as weekends.
WORKDAYS(start, due, weekend)
Replace weekend with one of the following values:
| Weekend Code | Days Considered Weekend |
|---|---|
| 1 | Sat, Sun |
| 2 | Sun, Mon |
| 7 | Fri, Sat |
| 9 | Fri, Sun |
| 11 | Sun |
| 16 | Fri |
Conditional Logic
How do I create conditional formulas in Quire?
You can use the conditional operator ?: to return different results based on a condition. This works similarly to an IF statement.
You can have two results, it will show the first result if the condition is true and show the second result if it’s false.
Example: Display status indicators based on time spent (when the total time spent for a task is over 5 hours)
timeSpent > 5h ? "🔴" : "🟢"
- Condition:
timeSpent > 5h - Result if true: 🔴
- Result if false: 🟢
Sorting and Ordering Values
How do I sort multiple values using formulas?
Use the SORT function to arrange values in ascending order.
For example, if you have 4 subtasks and their due dates are Sep 1, Aug 23, Sep 1, Jul 30 respectively:
SORT(subtasks.due)
Result: It will sort the subtasks’ due dates from earliest to latest and list out all the due dates in the field.
Jul 30, Aug 23, Sep 1, Sep 1
How do I remove duplicate values from sorted results?
Combine SORT with the DISTINCT function.
You can see in the result that there are two subtasks with the same due date (Sep 1). Try:
DISTINCT(SORT(subtasks.due))
Result:
Jul 30, Aug 23, Sep 1
How do I order subtasks by due date while displaying their names?
Use the order by operator.
subtasks order by any.due
This finds subtasks and orders them by their due dates.
Note: You can use the any identifier with the order by operator to specify the field you would like the order to be in.
Learn all the different operators and functions you can use in the Quire formulas.