# Details of "IF" comparisons

HI All,

Some help would be appreciated - This seems to be not as simple as I thought.

I am trying to build a table to calculate loan balances from month to month. I created the formula as shown below.

And got the results below:

Which at first looked great, I thought I had only the else part to fix. But it turns out that the IF always evaluates to true. Whether I put 1, “1”, 8 or “8”.

Please relieve me of my misery, what am I missing?

Regards
Piet

it looks like the result of the expression before the !=1 is not a single number but a list of numbers. ie; the entire column perhaps?

so you need to reduce this to a single value before comparing it to 1.

maybe you need .First() or .Last() or .Filter(someSelection) to return a single value?

or, more likely, thisRow.Maand ?

the symbol following Maand is 123 inside 2 boxes, which indicates its a list of numbers. the symbol for a single number is 123 inside a single box.

hope this helps

max

1 Like

hi @Piet_Strydom , since you try to calculate interests over loans, did you consider using `Power()`, this function avoids that you have to apply a spreadsheet logic in which you work with previous rows.

You can get something like below:

hope it helps, Christiaan

1 Like

HI Max,

This definitely helps, thanks. I am still struggling with the data typing.

Regards
Piet

Hi Christiaan,

Thanks for the idea. What I am working on is to allow for variable payments and reversals into a loan account. And the technique will also be helpful in other areas where one wants to work with financial information over a period of time exceeding a year.

One day, when I am grown up, I want to use Coca to create a financial forecasting tool for the ideas in this: Retirement Funding - A Layered Approach · MONIE Orchards

Thanks!
Piet

2 Likes

@Piet_Strydom

i have to keep reminding myself… coda uses LISTS for everything in CFL. even a list of one item is still a list. catches me out all the time.

i LOVE your document on saving for retirement! so much wisdom.

only one problem… i am 67 ! so its too late for me .

young folks! read this wisdom and take action while you still have time!

max

1 Like

HI Max,

Christiaan is also repeatedly stressing the fact that results are actually lists, but I am still struggling. (Not using it enough…)

Thanks for the comments on MONIE Orchards. I am 59, so much of that is - "This is what I SHOULD have done…

R
P

Thanks Max, I think I understand it now…

I should not have referred to the table in the IF in the first place.

HI all,

Anybody that needs to build a table for a loan account with payments, withdrawals and an interest calc, please feel free to use this. It has one month in a row, and is quite a bit quicker to set up than 12 months in a row.

Enjoy
Rambling Pete

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.