Google Sheets: generating a filtered array and doing a sumif in the same formula -
i have document column ('source'!d:d
) built formatting:
country → name → id country → name → id country → name → id country → name → id
in same document, there's column ('source'!aa:aa
) numbers. i'd sum numbers if country in cold
example usa. can't add columns in source
document, need generate array countries "polished" inside formula. i've tried this, it's not working. arrayformula , regextract work (the standalone bit indeed generates array country names), think 2 criteria "don't talk each other", they're separated bits, not referring same row anymore.
=sumifs('source'!$aa$100:$aa,arrayformula(regexextract(arrayformula('source'!$d$100:$d), "^(.+?)→")),"usa")
how can change formula above work?
the logic of formula correct (the inner arrayformula unnecessary, not harm). works correctly sample data in spreadsheet. problem has in data; perhaps country names followed space before arrow?
but recommend taking different approach, filter
, regexmatch
:
=sum(filter('source'!$aa$100:$aa, regexmatch('source'!$d$100:$d, "^usa\b")))
this has simpler logic (match vs extract), should easier debug.
Comments
Post a Comment