Sum each column (not the whole row), only for numeric values, and make a list of the column-wise totals

Given this example:

[
["4-May-2025", "Sunday", "", "22", "107", "2.2", ...],
["4-May-2025", "Sunday", "", "5", "69", "1", ...],
["4-May-2025", "Sunday", "", "88", "223", "13.2", ...]
]

i want to get:

Column 4: 22 + 5 + 88 = 115

Column 5: 107 + 69 + 223 = 399

Column 6: 2.2 + 1 + 13.2 = 16.4

... and so on...

so how do i do it?

This shows each stage of the process in Blocks! (can be simplified!)

suppose at index 9 there is a string and at index 10 is a number, will it work then?

this is what i did...
does it need improvement?

In first post you have asked about sum of particular index of each row but in this example you are trying to sum from csv row text.

Make sure what is your requirement. Once you do make blocks try do it option

Here's my take on a general solution:
image


columnar_sum.aia (4.2 KB)

What if table checkfortoday has long or short rows?

suppose the data is like this
[["Alice", 12, tex, "15"], ["Bob", 13, 91.0, "A"], ["Charlie", 5, 5, "5"]]
so how i do this after addition the new data wil be ["Alice", 30, "96.5", "20"]
i mean
For each index (column in list of lists):

  • If 2 or more values at that index are numbers, return their sum.
  • If only 1 value is a number, return that number.
  • If no numbers at that index, return the value from the first sublist.

There must be a few more alternatives you can come up with ?

Initialize finalList as an empty list.

Get the number of columns from the first sublist.

Loop through each column index (i from 1 to number of columns):

Initialize sum to 0 and count to 0.

For each row in the list:

    Get the item at index i.

    If it's a number:

        Convert to number (if it's text)

        Add it to sum

        Increment count by 1

After checking all rows:

    If count == 0: add item from first row at index i to finalList

    If count == 1: add the number (not sum) to finalList

    If count > 1: add the total sum to finalList

Result is stored in finalList. just checking working or not

Have you tried the method given in post no.2 or anything?
My suggestion also others suggestion works based on that thing only. if is number and not empty

Here's a recursive solution, preserving the first of any purely alpha columns:

image


columnar_sum.aia (4.9 KB)

Thank You :smiling_face_with_three_hearts: