Coda the delta between two dates
applied in interest related calculations
My brother sent me an Excel file with loan and interest calculations. I’m trying to recreate it in Coda. One tricky part is calculating the time between the start and end dates — it’s simpler than it looks, once you see it.
We start by calculating the difference in years, but that’s not quite right.
We need to add a bit of logic to get the full years only.
We can then subtract to get the remaining days, which we’ll call “restdays.”
Most years have 365 days, but leap years have 366. To be precise, we check if the year is a leap year and divide the “restdays” by either 366 (for leap years) or 365 (for non-leap years).
Finally, we add the years we calculated earlier. This sum is the number we need for our interest calculation.
See? It wasn’t so difficult after all, especially when broken down into logical steps.
The number of months
In financial calculations, you often need the number of full months between two dates. You can use a formula for this, where the RelativeDate()
function is key.
The screenshots are based on this document.
I hope this article was informative and helpful. Did it help you to solve a problem you unlike would have solved other ways? What about a donation?
My name is Christiaan, and I regularly blog about Coda. While this article is free, my professional services (including consultations) are not, but I’m always happy to chat and explore potential solutions. You can find my free contributions in the Coda Community and on X. The Coda Community is a fantastic resource for free insights, especially when you share a sample doc.
All the AI features we are starting to see appear — lower prices, higher speeds, multimodal capability, voice, large context windows, agentic behavior — are about making AI more present and more naturally connected to human systems and processes. If an AI that seems to reason like a human being can see and interact and plan like a human being, then it can have influence in the human world. This is where AI labs are leading us: to a near future of AI as coworker, friend, and ubiquitous presence. I don’t think anyone, including OpenAI, has a full sense of all of the implications of this shift, and what it will mean for all of us. — source: Ethan Mollick from One Useful Thing.
More about Coda AI and Coda Brain: