Subtracting selectable items, without creating additional columns with «ToNumber()»

Hello!

There are 3 columns and in the third column I need to get the difference (subtraction):
1

But the type of the first two columns is “Select list” ,so I did not get the result. How can I do it?
2

Here is what I tried:
3
4

So how to subtract selectable items, without creating additional columns with «ToNumber()» ?

I really hope for help. Thank you very much!

Dear @11177

Please check out if this sample is what you are looking for:

1 Like

@Jean_Pierre_Traets Thanks for your reply! Unfortunately it does not work - I tried this option - it is shown above, in the first screenshot.

My items (a1, a2) are selected from another table as «SELECTABLE ITEMS» as shown in the screenshot below - that’s why this doesn’t work.

As example:

@11177

Have a look at Section 2. See if the formula in the blue column is helpful in some way.

1 Like

@Ander Thank you so much for your reply! Amazing! :clap: It works! But why the type of column is text, how is it possible? interesting logic… Moreover, with further mathematical operations with data in the column, everything works. Thank you very much! :+1: :grinning:

1 Like

Hi @11177,

Welcome to the Community!

It looks like you’ve stumbled onto one of the key differentiators of Coda. There are subtle clues to what’s going and once they’re pointed out, I think they’ll make more sense.

You’re using a Lookup to another table, which is great, but we allow you to pull in various values this way. When you use a Lookup like this, you can pull in an entire row of data and then you can reference each column from that row individually if you’d like.

In your first post, you’ll see a small row icon next to the a1 and a2 in your formula. This means the row is being pulled in. If there is a column in that row called “My Number”, you can narrow down the data you’re using to that specific data item by using dot notation:

a1.[My Number] and a2.[My Number]

So in your first post, you’re trying to subtract one array of data from another array of data. Using the dot notation to get to the actual number column, you’ll be subtracting one number from another number.

In Excel, this might be correlated to a VLOOKUP formula, but with Coda, these become very simple steps and quick to write and reference.

3 Likes

@11177

The data type of the column [Table 5].[column value] is the number data type. This data type can be used in math.

The data type of both columns [Table 1].[reference to row object] and [Table 1].[reference to row object 2] is the row reference data type (indicated by the thin blue border). This data type cannot be used in math. You must first access the specific column on the row being referenced that is the number data type with which you want to perform math.

You access the column on the row reference via “dot access” like this: rowReference.column

thisRow.[reference to row object].[column value]-thisRow.[reference to row object 2].[column value]

The same goes for all other data types (text, dates, etc.) Row references get you to the row, and then you must specify which column on that row you want to work with.

EDIT: Yeah, what @BenLee said! :grinning:

3 Likes

Dear @11177

In the today’s Crowdcast webinar fragment we ended up in the same situation as @BenLee and @Ander explained that we need always to be careful to compare the same types.

2 Likes

Hi @BenLee, @Ander, @Jean_Pierre_Traets :grinning:

Thank you very much for the explanation and for your time - it is invaluable.

@BenLee,

stumbled onto one of the key differentiators of Coda.

It seems to me not quite, I rather stumbled on a practical application in my case.
For me, the logic of Coda looks something like this:

So in your first post, you’re trying to subtract one array of data from another array of data.
a small row icon next to the a1 and a2 in your formula

I did understand it before (or I thought I did), but now it has become clearer with logic of the Coda, in a way of how to work with syntax, how to use it. Clarifying the meaning of a small row icon helped me a lot. BUT…

I have to apologize for my English - this is not my native language, plus trying to understand the logic is even more difficult.

Therefore, I ask you to forgive me, BUT some of your expressions (sentences) do not correspond to how I understand this.

This is
2
аггау of data, for example: [1,3,5,7,11,13]

You said: «This means the row is being pulled in»
Well, let it be a row (actually it is, for example: [1,3,5,7,11,13]) and the data for this row is collected from a column, in my case a1. (or it doesn’t collected from the column? ).

But then you said: «lf there is а column in that row called “Му number”…»

How can there be another column inside a column?

In my case the row a1:

@Ander, I just did not work with text type columns in this way - now I will know that it is possible.
@Jean_Pierre_Traets Thank you, it is an interesting example.

1 Like

Hi @11177,

Good questions here and it is something that’s kind of unique.

When you see the capsule or border around a value that’s in a column, you’re looking up the value of an entire row from a table. So the data of all of the columns in that particular row are stored in that capsule. If you want to use one of the data items individually, for calculations for instance, you need to specify that individual piece of data.

Let’s say your Client table has three columns, Name, Date, and Balance($). If you want a sum of two clients, let’s say they work for the same company, then you need to sum the Balance column. If you just reference the row, you’re trying to create a formula that looks like this:

(Client 1 Name, Client 1 Date, Client 1 Balance) + (Client 2 Name, Client 2 Date, Client 2 Balance)

which won’t give you a number. However, if you reference the row and the column, you can add just the Balance of each:

(Client 1 Balance) + (Client 2 Balance)

and this is a number, so it can be done.

In your table, Client 1 is the whole row, but Client 1.Balance would be row and column specific.

You might be able to see easier in a GIF:

1 Like

@BenLee Thank you so much for your help! :clap: :+1: :smile:

I add a little bit, if someone will read this thread and for myself:

and answering my question

If there is a column (in another table) called “My Number”, we can narrow down the data in that row and use it in main table. Thus we can use data from any cells (in DIFFERENT tables) and combine them in main table (for example).

I thought maybe someone should create a branch for Russian speakers - I don’t know how much it is needed and in demand (therefore I did not create one), so I wrote about it in Russian.

Для русскоговорящих: если вы несильны в English или что-то не сходится (и вам повезло и вы наткнулись на эту ветку).

В общем, если отчаялись и совсем не понимаете как настроить под себя coda.io - создайте ветку для русскоговорящих на community.coda.io (если ее не создали другие) и спросите по-русски - думаю здесь найдутся люди, которые смогут вам пояснить.

Да, я буду первым или 10-ым (это неважно), который прочитает ваше сообщение на русском - мне кажется вопрос с этой веткой дело времени.

ps Пишите мне в личку, если что.

tags: русский , язык , россия , рф , по-русски , кода

Hi @11177,

I appreciate the need of a more locale-friendly approach, however, I believe that the real added value of a community is to share learnings.
Having languages segregations might help some people, but would somehow “dissipate” a lot of energy in different directions.

I am Italian native, but I consider a given that I will have to interact through the - de facto - lingua franca of technology.

This is obviously my personal opinion and I can understand different perspectives.

Cheers!

1 Like