Fill table columns with a string based on another column value

Hi!
I need automatically fill a column with a value based on another column value. This is possible?

Ex:
Column A, Row 1 = New Book
Column B, Row 1 = NB1 (Automatic generated by formula)

So each time I have a row in columns A with New Book value, I need a new NB+Sequencial Number in column B automatic.

Hi @Jean_Silva_de_Santana
and welcome to Coda Community!

Is ā€œNBā€ because you need initials of the title (New Book)?

Try this formula:

Format("{1}+{2}", 
  ColumnA.Split(" ")
    .FormulaMap(CurrentValue.Left(1))
      .Join(""),
  thisRow.RowId()
)

Let me know.
Cheers!

3 Likes

Hi @Federico.Stefanato .

Yes, is the initials :grinning: Thanks

The formula woks perfectly, but I needed to define myself the initials I want use for each case. Another thing, is possible to start a new index and follow the last number for each condition?
Ex: New Book- NB1, NB2ā€¦
New Document - ND1, ND2ā€¦

Hi @Jean_Silva_de_Santana,
sure: have a look at this example:

Let me know if this helps.

2 Likes

Yes! is this. Thank you :slight_smile:

1 Like

@Federico.Stefanato , how woud you solve something like below? The logic behind is that you group by name and order in the sequence as they appear in the table. The first group is One, the second group is Three, the third Group is Two.

Hi @Christiaan_Huizer ,
have a look at the modified example: is this what you wanted?

But now Iā€™m curious to know the underlying use-case!! :smiley:

Cheers!

1 Like

hi @Federico.Stefanato , briljant!

The use case is a calculation in which I need to check if a bus that arrives (for example in Brussels) is in time to operate a second line. The trip (i.e. Amsterdam ā†’ Brussels via multiple stops) is trip 1, while trip 2 is Brussels - Amsterdam via Antwerp, Rotterdam, The Hague etc.

I was on the outlook for a way to define the trip as a number to get the the value of a minus one (thus for line 3 we look if line 2 arrives in time and for line 2 we look at line 1).

Since I am dyslexic I cannot relay so much what I see, I need to calculate the outcome in case the question is how many buses and drivers we need to execute two lines.

Thx! Christiaan

:smiley:

Happy it worked!

:bus: :bus: :bus:

1 Like