Help

Multiple values in one cell?

Topic Labels: Scripting extentions
9262 7
cancel
Showing results for 
Search instead for 
Did you mean: 
Mika1
4 - Data Explorer
4 - Data Explorer

I’d like to add multiple values into one cell. Preferably so that these values add up to one summarized value to another cell. How to do this?

Example: A 17.5 meters long flag festoon is done of 4 snippets of 5 meters, 5 meters, 5 meters, 2.5 meters. These snippet values should be in one cell and add up to total length into another cell.

7 Replies 7

From where are these numbers coming? Are you typing them in manually? Are they pulled by an automation? Are you trying to parse a larger corpus of text? Can you share a screenshot of the exact field you already have?

The more details you can provide, the better the chances of getting help. But Airtable’s formula fields should have you covered in this instance. They’re more than powerful enough for such use cases, so try to read up on them and see if anything comes to mind. If nothing else, come up with a bad plan, then report back explaining how it failed - those types of help requests usually get resolved the quickest.

Welcome to the Airtable community!

Are you coming from a spreadsheet background? Airtable is a database, not a spreadsheet, and thus it works differently. There are only a handful of field types that allow entering multiple values: linked record fields, multiple select fields, multiple collaborator fields, and attachment fields. There is no field that will let you store multiple numbers directly.

What you can do is use linked record fields to store multiple values. You could have one table of [Products] that would include a row for a festoon, and another table of [Snippets] that would include rows for snippets. In your example, you would have four snippet rows with 5, 5, 5, and 2.5 as the length for each row. All four of these snippets would be linked to the festoon, and then you would have a rollup field to sum the total length.

These numbers are typed manually. Now they are in a text field as you can see in the image, on the left total length and on the right the snippets. I’d like them to add up to the full length column.IMG_20210825_083006

luna_luna
4 - Data Explorer
4 - Data Explorer

To Multiple data in one cell, Combine data with the Ampersand symbol (&) · Select the cell where you want to put the combined data. Type = and select the first cell you want to combine.

luna_luna
4 - Data Explorer
4 - Data Explorer

The moves toward Multiple data in one cell:

  1. Open up your exercise manual.
  2. Select the cell you need to put every one of your information.
  3. Type = and select the main cell you wish to join.
  4. Type and use quotes with space encased.
  5. Select the other cell you need to join and hit enter. For instance =A3&" "&B3.

Hi @Mika1,

Not sure how I got to this super old post, but it looks like a topic worth solving! Obviously getting bunch of numbers into a single field is not a good idea, but if that is the input data - it can be summarized with script below.

I assumed that white space or comma is used to separate numbers.

// Change this name to use a different table
let table = base.getTable("Summary");

// Prompt the user to pick a record 
// If this script is run from a button field, this will use the button's record instead.
let record = await input.recordAsync('Select a record to use', table);

if(record){
    const textValues = record.getCellValue("oluet lasketaan")
    // here we are spliting the text using comma "," and whitespace "\s" as separator
    // you can but any other separators in the [] regex bracket
    const arrayWithTextValues = textValues.split(/[,\s]+/) 
    // converting text to number and summing up all values, 0 - is initial value
    const sum = arrayWithTextValues.reduce((a,b) => Number(a) + Number(b),0)
    //updating number field
    table.updateRecordAsync(record, {"kokonaiskulutus": sum})
}

I hope that helps :winking_face:

Was it in the list of suggested topics at the bottom of a thread? Sometimes those topics are super old. I find I have to be careful looking at dates when reading them. On the other hand, they often have interesting questions. Airtable also changes so fast that we can come up with new solutions that did not previously exist.