# Help to repair the formula

#1

Does anyone see a mistake in writing my formula? I will be grateful for your help. I’ve been fighting it for an hour now.

#2

@Przemek_Sawicki

Are `Date` and `daterangepicker1` the same data types? (One appears to be Date, while the other appears to be Date/Time.)

#3

hi @Ander

Thank you for your suggestion but It doesn’t look like that’s the cause. In another cell, both of them work together properly.

#4

@Przemek_Sawicki

Do you need a dot between `Matches()` and `SquareRoot()`?

#5

Nope, it’s not that

#6

It looks like there’s a missing dot after the filter - it just runs right into the SquareRoot with a space.

#7

Nope, it’s not that

#8

Would you care to explain what is the desired outcome? You filter a table, then try to square root a number, then count the number of rows?! Honestly I can’t make any sense of it.

#9

I try to count the square root by referring to the table data for a given period of time.

Below is an example of using the same formula that works. The only difference is that there is no filtering.

#10

Well, it was that because the error message has changed. Now it’s something else.

It’s going to be easier if you just share the doc so we can take a proper look, but now it looks like inside the SquareRoot function you’re trying to divide the sum of a list of numbers by a list - you can’t divide a number by a list.

Notice in the version that works you’re dividing the sum of a list of numbers by the count of a list of numbers (i.e. dividing a number by another number) - do you just need to move the close bracket of the SquareRoot function to after the Count() instead of before it? That way it will match the version that works.

#11

The link to the file is in the post at the beginning. Anyway, I also share the file below:) Thank you for your help.

#12

Nope, it’s not that:(

#13

Can you share the app? What’s the error message now?

#14

I don’t understand, I’ve uploaded the file above, haven’t I?

#15

Sorry, I linked in right at the end of the thread and didn’t see it…

#16

1 Like
#17

There are two ways you can write formulas in Coda. You can either do:

`a.sum()`

or:

`sum(a)`

They both take a list of numbers and sum them up. So far so straight-forward.

But what happens if you try and mix the two ways? What happens if you do something like this?

`a.Sum(b)`

If you’re writing formulas like this it’s likely that you’ve gone wrong and you need to take a step back and think about what you’re doing. You’ll either end up with a formula that doesn’t work because it has an error (like above) or you’ll end up with something that works but is a bit strange. Like this:

The first number (15) is the sum of all the numbers from Column 1 that are greater than 2: 4, 6 and 5.

The second number is the same sum but with Column 2 specified inside the Sum function. How does it get to 28? It does the same sum as the first example to get 15, then it adds on everything in Column 2. It works, but is it meaningful? Is it easy to understand to someone else? I’d say it’s better not to write formulas like this.

1 Like
#18

@Nick_Milner

Your help is invaluable. Thank you very much. I still have to practice everything you have written. Step by step but I hope that my skills will move in the right direction.

1 Like