Sum up values based on comma separated values that reference a table

aperkinsptx

New Member
Joined
Dec 2, 2014
Messages
2
Hi, I'm new to posting on forums like this so bare with me as I try to explain what I'm attempting to accomplish.

My company has a lab and we run different tests for different samples. I'm trying to find the total time the sample will take to run based on the tests selected. We currently have lists of tests to run listed in a single cell as comma separated values. I have a separate sheet where I have listed each of those tests and the average time for each test to be run. I'd like to return the sum.

Below is how I would do it manually. The formula would be in the "Total Sample Time" column.

Tests to Run
Total Sample Time
Test 1, Test 2, Test 3 = 5+10+12=27
Test 3, Test 4
=12+1=13
Test 1, Test 3, Test 4 , Test 5 =5+12+1+15=33

<colgroup><col><col></colgroup><tbody>
</tbody>

Test Type
Time (min)
Test 15
Test 210
Test 312
Test 41
Test 515

<colgroup><col><col></colgroup><tbody>
</tbody>

I'm just not sure what type of formula needs to be in the cell to be able to sum up the values from a table based on the comma separated values.

Thanks in advance for your help!
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,008
Assuming that A1:B11 contains the table, try...

B2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=SUM(IF(ISNUMBER(SEARCH(","&$A$7:$A$11&",",","&SUBSTITUTE(SUBSTITUTE(TRIM(A2)," ,",","),", ",",")&",")),$B$7:$B$11))

Note that the formula allows extra spaces within the text string, such as the text string in A4. Also, note that the SEARCH function is not case-sensitive. For a case-sensitive formula, replace SEARCH with FIND.

Hope this helps!
 

Forum statistics

Threads
1,081,990
Messages
5,362,584
Members
400,683
Latest member
LogChief

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top