Search code examples
google-sheets-formulaspreadsheet

google sheets "sum" not working on a column full of query result


I have a column filled with this query. ={QUERY(asientos!B1:F198;"select C,D where B = "&B2;0)} data source the query will look for the data here. There is no problem yet this is the result and it's fine query fill data

the problem is that I can't add the first column, surprisingly the second column works fine see the formula without adding numbers on the left column, but the right don't know why

here is the sheet https://docs.google.com/spreadsheets/d/1dgiXBBFEyJzijSsJrrSlm7WcR1znPO9OSNV0TiKua_A/edit?usp=sharing

https://docs.google.com/spreadsheets/d/e/2PACX-1vTWpTmhZbJ-6pdai6s780M3dGzaZaTHvML_J2pQGL6IWfl3Ar7Mb16UdSVkIm1upc2xOQ1Lxe-IG1b5/pubhtml

I would have to be able to add the left and right clolumns, not only one. I don't know why doesn't work or how to resolve the problem


Solution

  • query() does not react well with mixed data-types present in a single column. Your asientos columns C & D which you are referencing within the query is full on loaded with mixed data-types (numerical & text) which is resulting in this ruckus. this article here gives a detailed explanation on what is this issue & how to deal with it and all...

    alternatively you could use this in mayor!B4 instead:

    =filter(asientos!C1:D198;asientos!B1:B198=B2)
    

    enter image description here