# Formulas

**URL:** https://community.nocodb.com/c/formulas/12.md

[Latest](https://community.nocodb.com/latest.md) · [Categories](https://community.nocodb.com/categories.md) · [Tags](https://community.nocodb.com/tags.md)

---

## [About the Formulas category](https://community.nocodb.com/t/about-the-formulas-category/21)

<div class="topic-metadata">

**Author:** [@Navi](https://community.nocodb.com/u/Navi)\
**Replies:** 0

</div>

---

## [Formula query across multiple tables?](https://community.nocodb.com/t/formula-query-across-multiple-tables/2236)

<div class="topic-metadata">

**Author:** [@Ulrich](https://community.nocodb.com/u/Ulrich)\
**Replies:** 1\
**Last updated:** [May 13, 2026, 12:39pm UTC](https://community.nocodb.com/t/formula-query-across-multiple-tables/2236 "2026-05-13T12:39:54Z")

</div>

As part of my database migration to nocodb, I need to rewrite a few formulas, including this one. "if ‘Gültig ab’ != null then let myDatum := 'Gültig ab'; let Fahrplansaison := first(select Fahrplansaison where Start \<…

---

## [How to format the output of the DATETIME\_DIFF formula](https://community.nocodb.com/t/how-to-format-the-output-of-the-datetime-diff-formula/2235)

<div class="topic-metadata">

**Author:** [@Ulrich](https://community.nocodb.com/u/Ulrich)\
**Replies:** 1\
**Last updated:** [May 13, 2026, 12:18pm UTC](https://community.nocodb.com/t/how-to-format-the-output-of-the-datetime-diff-formula/2235 "2026-05-13T12:18:27Z")

</div>

I’m trying to calculate the difference between two “Date Time” fields as a time using the formula “DATETIME\_DIFF({Arrival Time}, {Departure Time})”. When I format the field as “Time”, the result is always 1:00 or 1:02. …

---

## [DATEADD - can the output just be MMM YY](https://community.nocodb.com/t/dateadd-can-the-output-just-be-mmm-yy/2151)

<div class="topic-metadata">

**Author:** [@Ian](https://community.nocodb.com/u/Ian)\
**Replies:** 1\
**Last updated:** [January 13, 2026, 5:17pm UTC](https://community.nocodb.com/t/dateadd-can-the-output-just-be-mmm-yy/2151 "2026-01-13T17:17:28Z")

</div>

Hi, I have this formula; DATEADD({REVIEWED ON}, 1, “year”) I want the output to be just MMM YY but that’s not available in the list of options for formatting the field. I am currently getting DD MMM YY. Can this be ac…

---

## [Trying to create a SWITCH statement with multiple conditions (like a nested IF)](https://community.nocodb.com/t/trying-to-create-a-switch-statement-with-multiple-conditions-like-a-nested-if/2150)

<div class="topic-metadata">

**Author:** [@Ian](https://community.nocodb.com/u/Ian)\
**Replies:** 2\
**Last updated:** [January 8, 2026, 2:55pm UTC](https://community.nocodb.com/t/trying-to-create-a-switch-statement-with-multiple-conditions-like-a-nested-if/2150 "2026-01-08T14:55:08Z")

</div>

Hi folks, I have a SWITCH statement which reads; SWITCH({REVIEW CADENCE}, “Annual”, DATEADD({LAST REVIEW/SERVICE copy}, 1, “year”), “”) It basically takes a column formatted to YYYY-MM and adds X numbers of months bas…

---

## [IF formula with DATEADD as a condition - cannot get this to work](https://community.nocodb.com/t/if-formula-with-dateadd-as-a-condition-cannot-get-this-to-work/2105)

<div class="topic-metadata">

**Author:** [@Ian](https://community.nocodb.com/u/Ian)\
**Replies:** 2\
**Last updated:** [October 9, 2025, 9:54am UTC](https://community.nocodb.com/t/if-formula-with-dateadd-as-a-condition-cannot-get-this-to-work/2105 "2025-10-09T09:54:24Z")

</div>

Hello, I am trying to create an IF formula containing this; DATEADD({REVIEWED ON}, 1, ‘year’) So it would read; IF({REVIEW NEEDED?}=“Yes”,(DATEADD({REVIEWED ON}, 1, “year”)),“”) However, it’s simply not working - cl…

---

## [Cannot read properties of undefined (reading 'uidt')](https://community.nocodb.com/t/cannot-read-properties-of-undefined-reading-uidt/2049)

<div class="topic-metadata">

**Author:** [@Petrogrado\_1917](https://community.nocodb.com/u/Petrogrado_1917)\
**Replies:** 9\
**Last updated:** [August 14, 2025, 1:50pm UTC](https://community.nocodb.com/t/cannot-read-properties-of-undefined-reading-uidt/2049 "2025-08-14T13:50:52Z")

</div>

where Persona is Links field

---

## [Get linked fields using formula](https://community.nocodb.com/t/get-linked-fields-using-formula/2039)

<div class="topic-metadata">

**Author:** [@GIPeN](https://community.nocodb.com/u/GIPeN)\
**Replies:** 1\
**Last updated:** [August 8, 2025, 3:27am UTC](https://community.nocodb.com/t/get-linked-fields-using-formula/2039 "2025-08-08T03:27:57Z")

</div>

I’m trying to repace notion, but hadn’t found an alternative, airtables can’t do this either: have 3 tables, A → B → C , and want to get data from A in C but cant find a way For example I have a clients table, a contra…

---

## [Formatting Formula Results - No Date format, no numeric format](https://community.nocodb.com/t/formatting-formula-results-no-date-format-no-numeric-format/1676)

<div class="topic-metadata">

**Author:** [@jbo](https://community.nocodb.com/u/jbo)\
**Replies:** 7\
**Last updated:** [April 8, 2025, 4:49am UTC](https://community.nocodb.com/t/formatting-formula-results-no-date-format-no-numeric-format/1676 "2025-04-08T04:49:36Z")

</div>

Hello, I’m starting my journey with nocodb. My config : nocodb 0.260.2 with self-hosting. I notice the formatting formula results for date and numeric aren’t available (test on opera): I check the docs : I know…

---

## [Nested Formulas](https://community.nocodb.com/t/nested-formulas/1735)

<div class="topic-metadata">

**Author:** [@dop](https://community.nocodb.com/u/dop)\
**Replies:** 1\
**Last updated:** [March 20, 2025, 6:23pm UTC](https://community.nocodb.com/t/nested-formulas/1735 "2025-03-20T18:23:56Z")

</div>

Can someone please help me here. I have set up a self hosted version of NocoDB with the help of coolify. I use Postgres as database. In principle everything works with the exception of the nested formulas. If I refer to …

---

## [Line breaks in string formula?](https://community.nocodb.com/t/line-breaks-in-string-formula/1604)

<div class="topic-metadata">

**Author:** [@achepa83](https://community.nocodb.com/u/achepa83)\
**Replies:** 1\
**Last updated:** [January 17, 2025, 3:15pm UTC](https://community.nocodb.com/t/line-breaks-in-string-formula/1604 "2025-01-17T15:15:10Z")

</div>

Hi there, I would like to create a simple address column that shows a combined address from other columns like “street”, “city”, “zip code”, “country” and so on. This is no problem with CONCAT({street}, {city}, {zip co…

---

## [Question field error](https://community.nocodb.com/t/question-field-error/1595)

<div class="topic-metadata">

**Author:** [@Farah](https://community.nocodb.com/u/Farah)\
**Replies:** 1\
**Last updated:** [January 15, 2025, 4:13am UTC](https://community.nocodb.com/t/question-field-error/1595 "2025-01-15T04:13:57Z")

</div>

I have a date field, and I would like to transform it into a single selection field with the same format as the date, which is dd/mm/yyyy. Whenever a new value is added to the date field, I want the single selection fiel…

---

## [Nested IF Formula](https://community.nocodb.com/t/nested-if-formula/1594)

<div class="topic-metadata">

**Author:** [@Farah](https://community.nocodb.com/u/Farah)\
**Replies:** 1\
**Last updated:** [January 14, 2025, 10:30am UTC](https://community.nocodb.com/t/nested-if-formula/1594 "2025-01-14T10:30:26Z")

</div>

I have this formula: IF({Montant payé} = 50, {Prix}, {Prix} - {Montant payé} - {Montant code}) I would like to implement it in NocoDB.

---

## [Nested IF formula error](https://community.nocodb.com/t/nested-if-formula-error/1593)

<div class="topic-metadata">

**Author:** [@Farah](https://community.nocodb.com/u/Farah)\
**Replies:** 1\
**Last updated:** [January 13, 2025, 5:08pm UTC](https://community.nocodb.com/t/nested-if-formula-error/1593 "2025-01-13T17:08:01Z")

</div>

I would like to make a formula like this with Nocodb IF(Pack=“X”,50, IF(Pack=“Y”,8, IF(Pack=“Z”,10, IF(Pack=“R”,100, IF(Pack=“F”,22, IF(Pack=“O”,160, IF(Pack=“E”,100, IF(Pack=“D”,1000, IF(Pack=“T”,99, IF(Pack=“…

---

## [DAY(), MONTH() but not YEAR() in formula fields](https://community.nocodb.com/t/day-month-but-not-year-in-formula-fields/1001)

<div class="topic-metadata">

**Author:** [@Petrogrado\_1917](https://community.nocodb.com/u/Petrogrado_1917)\
**Replies:** 5\
**Last updated:** [January 2, 2025, 11:44am UTC](https://community.nocodb.com/t/day-month-but-not-year-in-formula-fields/1001 "2025-01-02T11:44:35Z")

</div>

Hi, there. Why YEAR() function is not supported in the new versión but DAY() and MONTH() are? Is there a workaround to resolve this? Thanks.

---

## [How to should sum of price of all orders in customer table](https://community.nocodb.com/t/how-to-should-sum-of-price-of-all-orders-in-customer-table/1482)

<div class="topic-metadata">

**Author:** [@averactbe](https://community.nocodb.com/u/averactbe)\
**Replies:** 1\
**Last updated:** [November 18, 2024, 6:53am UTC](https://community.nocodb.com/t/how-to-should-sum-of-price-of-all-orders-in-customer-table/1482 "2024-11-18T06:53:48Z")

</div>

I have table Order in which I have column Final price which is a formula field. Now Orders quantity is shown in customer column. I want another column Customers table to show total sum of all order.totalPrice for that …

---

## [How to add time to a Date Time field](https://community.nocodb.com/t/how-to-add-time-to-a-date-time-field/1349)

<div class="topic-metadata">

**Author:** [@Lucas](https://community.nocodb.com/u/Lucas)\
**Replies:** 1\
**Last updated:** [September 7, 2024, 5:17am UTC](https://community.nocodb.com/t/how-to-add-time-to-a-date-time-field/1349 "2024-09-07T05:17:08Z")

</div>

Hi there. I have a Date Time field and a number field containing durations in minutes. How can I create a formula, which would add the duration to the Date Time field ? Exemple: DateTime field = 2024-09-06 18:00 Durat…

---

## [Blank or Null datetime fields](https://community.nocodb.com/t/blank-or-null-datetime-fields/1323)

<div class="topic-metadata">

**Author:** [@smc](https://community.nocodb.com/u/smc)\
**Replies:** 1\
**Last updated:** [August 27, 2024, 6:02am UTC](https://community.nocodb.com/t/blank-or-null-datetime-fields/1323 "2024-08-27T06:02:31Z")

</div>

Trying to sort out how to create an IF statement based on whether or not a datetime field has an entry … and it is defeating me. What I’m trying to do: I have various projects underway, and I’d like to calculated the n…

---

## [How can I get notifications in case new forms input/ records get created?](https://community.nocodb.com/t/how-can-i-get-notifications-in-case-new-forms-input-records-get-created/1259)

<div class="topic-metadata">

**Author:** [@Questonado](https://community.nocodb.com/u/Questonado)\
**Replies:** 1\
**Last updated:** [July 3, 2024, 11:43am UTC](https://community.nocodb.com/t/how-can-i-get-notifications-in-case-new-forms-input-records-get-created/1259 "2024-07-03T11:43:48Z")

</div>

I read note that you should install something form the “AppStore” but this “Nocodb AppStore” seams not more to exist. I would like to know how I can get notified each time I receive form Nocodb forms a new message.

---

## [Using constanst defined in Table1 into another Table2](https://community.nocodb.com/t/using-constanst-defined-in-table1-into-another-table2/1213)

<div class="topic-metadata">

**Author:** [@mantielero](https://community.nocodb.com/u/mantielero)\
**Replies:** 1\
**Last updated:** [June 17, 2024, 3:58am UTC](https://community.nocodb.com/t/using-constanst-defined-in-table1-into-another-table2/1213 "2024-06-17T03:58:53Z")

</div>

I am new in NocoDB, so I do apolize if this is quite obvious. I’d like to have a Table1 that would be some sort of key-value store. I want to use those values for some calculations in a second table: Table2. How can I cr…

---

## [SQL query in a table as alternative to vlookup?](https://community.nocodb.com/t/sql-query-in-a-table-as-alternative-to-vlookup/1190)

<div class="topic-metadata">

**Author:** [@omnimercador](https://community.nocodb.com/u/omnimercador)\
**Replies:** 2\
**Last updated:** [May 24, 2024, 12:39pm UTC](https://community.nocodb.com/t/sql-query-in-a-table-as-alternative-to-vlookup/1190 "2024-05-24T12:39:07Z")

</div>

I realise that a vlookup function presently doesn’t exist in NocoDB, and a workaround is manually linking records via lookup. I was wondering whether there might be a way of creating a field which is a SQL query, to aut…

---

## [Showing Duration in Calendar view](https://community.nocodb.com/t/showing-duration-in-calendar-view/1187)

<div class="topic-metadata">

**Author:** [@Bobrabbit](https://community.nocodb.com/u/Bobrabbit)\
**Replies:** 5\
**Last updated:** [May 24, 2024, 8:13am UTC](https://community.nocodb.com/t/showing-duration-in-calendar-view/1187 "2024-05-24T08:13:08Z")

</div>

Hi, does anyone know how to show a duration in Calendar view, I’m looking to setup the dbase so I can have a start and end date, but then I want to be able to show the duration in Calendar view. I’ve looked at Duratio…

---

## [Formula column with the year of a date column](https://community.nocodb.com/t/formula-column-with-the-year-of-a-date-column/996)

<div class="topic-metadata">

**Author:** [@Petrogrado\_1917](https://community.nocodb.com/u/Petrogrado_1917)\
**Replies:** 0\
**Last updated:** [December 24, 2023, 8:59am UTC](https://community.nocodb.com/t/formula-column-with-the-year-of-a-date-column/996 "2023-12-24T08:59:08Z")

</div>

Hi. I have a date column and I want to have a corresponding formula column with the year of the other column. How can I do that? Thanks.

---

## [Reference rollup fields in functions inside Formula Columns](https://community.nocodb.com/t/reference-rollup-fields-in-functions-inside-formula-columns/917)

<div class="topic-metadata">

**Author:** [@Ashish424](https://community.nocodb.com/u/Ashish424)\
**Replies:** 3\
**Last updated:** [October 31, 2023, 6:28am UTC](https://community.nocodb.com/t/reference-rollup-fields-in-functions-inside-formula-columns/917 "2023-10-31T06:28:45Z")

</div>

I want to reference a rollup field inside a formula but get the following error. Is there any workaround/ plan for adding this ?

---

## [DATETIME\_DIFF with a column containing date strings](https://community.nocodb.com/t/datetime-diff-with-a-column-containing-date-strings/909)

<div class="topic-metadata">

**Author:** [@Ashish424](https://community.nocodb.com/u/Ashish424)\
**Replies:** 6\
**Last updated:** [October 23, 2023, 7:26am UTC](https://community.nocodb.com/t/datetime-diff-with-a-column-containing-date-strings/909 "2023-10-23T07:26:22Z")

</div>

I want to calculate the difference between NOW() and a formula column containing strings formatted as “yyyy/mm/dd”. As per the documentation, DATETIME\_DIFF can take strings formatted as yyyy/mm/dd. This works for consta…

---

## [Rollup referencing formula values](https://community.nocodb.com/t/rollup-referencing-formula-values/860)

<div class="topic-metadata">

**Author:** [@sscovil](https://community.nocodb.com/u/sscovil)\
**Replies:** 0\
**Last updated:** [August 16, 2023, 1:57pm UTC](https://community.nocodb.com/t/rollup-referencing-formula-values/860 "2023-08-16T13:57:48Z")

</div>

Is it possible to have a rollup column reference the values of a formula field in another table? Is it even feasible to add this functionality?

---

## [Date custom format](https://community.nocodb.com/t/date-custom-format/831)

<div class="topic-metadata">

**Author:** [@Dr\_MHQ](https://community.nocodb.com/u/Dr_MHQ)\
**Replies:** 0\
**Last updated:** [June 21, 2023, 1:17pm UTC](https://community.nocodb.com/t/date-custom-format/831 "2023-06-21T13:17:45Z")

</div>

Hi I’m trying to extract the day name based on date in another column Moreover I’m trying to extract the Month-year as well from another column Any clue how to do that ?

---

## [DATEADD shows "invalid formular"](https://community.nocodb.com/t/dateadd-shows-invalid-formular/790)

<div class="topic-metadata">

**Author:** [@Klappspatack](https://community.nocodb.com/u/Klappspatack)\
**Replies:** 3\
**Last updated:** [May 19, 2023, 9:15pm UTC](https://community.nocodb.com/t/dateadd-shows-invalid-formular/790 "2023-05-19T21:15:33Z")

</div>

I have Column 1 \[DateTime\] “Ordering Time” Column 2 \[Number\] “Driving Time” (Values between 120 to 300 minutes) Column 3 \[Formular\] “Estimated Delivery Time” I need Column 3 should be “Ordering Time” + “Driving Time…

---

## [Formula to calculate age from a birthday date](https://community.nocodb.com/t/formula-to-calculate-age-from-a-birthday-date/751)

<div class="topic-metadata">

**Author:** [@Rea](https://community.nocodb.com/u/Rea)\
**Replies:** 1\
**Last updated:** [February 14, 2023, 4:13pm UTC](https://community.nocodb.com/t/formula-to-calculate-age-from-a-birthday-date/751 "2023-02-14T16:13:06Z")

</div>

New to nocodb here and still not familiar with the formula syntax, I can’t figure out a way to make it work. So far I have this: DATETIME\_DIFF(NOW(), {BIRTHDAY\_COL}, "y") thank you for any guidance :slight\_smile:
