Combine lists based on index

Hello all. I am currently organising my book database and I am adding the dates I’ve started (date_started) and finished (date_finished) in my book notes.

In my book MOC base I would like to combine those lists in the order that the values are added. So date_started[0] would correspond to date_finished[0] and so on. Would this be possible in a formula? I would like to separate the two dates with an hyphen, if possible, but it’s alright if not.

I would also like to apologise if this has been asked before. I could not find a solution lol. TIA :slight_smile:

Can you clarify the order you want the notes in?

I couldn’t tell what you meant by either

I would like to combine those lists in the order that the values are added.

or

So date_started[0] would correspond to date_finished[0] and so on.

Are you saying you want to order the notes by date_started? Or by how long they took to read? Or something else?


I would like to separate the two dates with an hyphen, if possible

To display the dates as, for example, “2025-12-12 – 2026-01-10” in a column, you can use this formula:

date_started + " – " + date_finished

I meant if a book has start dates of 12.12.2024 [index 0] and 03.06.2025[index 1], and finished finish dates of 01.01.2025[0] and 08.07.2025[1], then the values should show:

12.12.2024-01.01.2025

03.06.2025-08.07.2025

and not in random order. :slight_smile: Sorry if my original post was confusing!

Understood. This formula is one way to put each pair on its own line:

" ".repeat(date_finished.length).split("").map([date_started[index], "–", date_finished[index]])

It displays a pair for every date_finished. To also display incomplete pairs (e.g., "01.12.2026 – " with a blank finished date until you fill one in), change date_finished to date_started in the .repeat().

Because each pair is on a new line, you would have to set your table row height to suit. Alternatively, you could display the pairs in a single line with a separator of your choice. Here’s one way:

" ".repeat(date_finished.length).split("").map(["•", date_started[index] + "–" + date_finished[index]]).flat().slice(1)

Edit: I wasn’t thinking. Instead of an arbitrary number of repeats then a filter, I edited the above to use the length of date_finished.

Thanks so much! That works wonderfully :slight_smile: