Forum Discussion
I am trying to search and sum values
- Oct 21, 2022
Carpusina The SEARCH part in your second formula returns an array of numbers or #VALUE errors. The IF function gets rid of the errors leaving a number when the words are matched in the same row. In your example only row5 has matching words "konzum" in both column A and D. The array that will be returned has three blanks and the number 8. SUM then returns 8.
You probably want to make use of a dynamic array function that will spill the result all at once.
Try this one in E2 and see if that does what you want:
=SUMIF(A2:A5;"*"&D2:D5&"*";B2:B5)
- Riny_van_EekelenOct 21, 2022Platinum Contributor
Carpusina The easiest would be to make sure you don't have blanks in column D. Why would you include blanks in a list to keywords to search for?
While writing this, I notice that HansVogelaar came up with a solution that excludes blanks.
- HansVogelaarOct 21, 2022MVP
=SUM(ISNUMBER(SEARCH(TRANSPOSE(D2:D5),A2:A5))*(TRANSPOSE(D2:D5)<>"")*B2:B5)