# Calculate due date based on corporate entity law

Hello –– New to Coda here and love it so far!

Here is the actual rule of law that I am trying to create logic for in a table within Coda.

In California, if you have a corporation, you must file a statement of information within the month you originally registered, every twelve months.

If you have an LLC, you must file a statement of information within the month you originally registered, every twenty four months.

If you have an LP, you do not need to file a statement of information.

My current formula is: SwitchIf(thisRow.[Entity Type]=“LLC”,RelativeDate(thisRow.[Registration Date],24), thisRow.[Entity Type]=“LP”,“N/A”,thisRow.[Entity Type]=“Corp.”,RelativeDate(thisRow.[Registration Date],12))

However, this presents a problem and I can’t think of a way to solve it. This formula only works for the first time a Statement of Information becomes due. What happens in the future if everything is tied to a registration date? I could make a column based on the last statement of information date submitted but the problem is that previous statements of information were not filed in the month of registration. Therefore, I’d need to take the month of the registration date and the last submitted statement of information date to determine what the due date would be in the future.

Is there a formula or tactic I’m missing here? Appreciate the help. Hope to learn enough to return the favor one day!

hi @Rocky_Slaughter , welcome to the community with an interesting question.

I show in a few steps what can be done, but notice that other makers maybe would propose an automation and a button. This is one way of dealing with the issue.

In step01 we generate a list of intervals, I went for 20. In the next step you see what this means.

Step02, we generate months using the interval

here we have a serie of 20 intervals we can add to the initial date and this will result in 20 dates as you imagine and see in step03

out of these 20 dates, we only need the date that is nearby, not all dates, nor even two dates, only the next date we need to file our statement, for this we need a filter we relate to.

I skip step 04 (adding the - `Today()` to get a list with days to go and you see below as part of step05) and move on to step05 in which I show the filter

as you notice, I created a table that contained the main values we work with, however in step05 I integrate all steps, so you only need one column.

Enjoy, Cheers, Christiaan

@Christiaan_Huizer Thank you for the speedy reply. It’s cool that the community is so active! I will try these steps… I think I need to learn. little more about the “CurrentValue” to understand if this will work but this gave me something to start with! Thank you.

@Rocky_Slaughter ,
to make it easier, you can create a table like mine and you create a column you fill out with the code snippet below. make sure the names do correspond. You are done in two minutes

``````Sequence(1,20).ForEach(Product(CurrentValue,thisRow.IntervalMonth).
WithName(intervals,

intervals.ForEach(
Date(
thisRow.Date.Year(),
thisRow.Date.Month() + CurrentValue,
thisRow.Date.Day()))

) - ToDay()).WithName(outcome,

Today() + outcome.Filter(CurrentValue > 1).First())
``````

`Currentvalue` is the item that is evaluated, we geneated a list with 20 currentvalues, 20 items.