Question

Say if I had on one sheet, let's call it S1

 T1  1
 T2  3
 T3  4
 T5  6
 T4  2

And say I have this in a cell in S2

 T1;T2;T3;T4   10

Is it possible to use excel functions to go to S1, find T1, T2, T3, and T4 and sum the values that correspond to them?

So far I have functions capable of searching for one string and pulling data out of it, but I don't know how to do it for delimited strings, or if it's possible to do it at all

=SUMIF('2014'!$B:$B, J9, '2014'!$F:$F)

EDIT: If I do not know the range of my values. Should I just put very large numbers?

Was it helpful?

Solution

If your first table is in S1!A1:B5 and in S2 sheet you have T1;T2;T3;T4 in cell A8 try this formula for the sum

=SUMPRODUCT(ISNUMBER(SEARCH(";"&'S1'!$A$1:$A$5&";",";"&A8&";"))+0,'S1'!$B$1:$B$5)

SEARCH searches for each value from A1:A5 surrounded by ";" signs in A8, also surrounded by ; signs, if there's a match you get a number so ISNUMBER returns TRUE and SUMPRODUCT adds the relevant value from B1:B5

SEARCH is not case-sensitive - if you need it to be then use FIND instead

See screenshot - shown on one sheet for simplicity but it's the same formula

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top