title: Sum values from another sheet based on a set of IDs
body: <p>I want to create a workbook that would help people log their eating habits. The workbook currently has two sheets, "Recipes" and "Diary". </p>
  
  <p>Recipes has columns ID, NAME, KCAL and PROTEIN. The user can add any recipes they frequently use, and just refer to them using the numeric ID.</p>
  
  <p>Diary has columns DATE, TOTAL_KCAL and TOTAL_PROTEIN. The idea is for each date the user could see the total amount of energy and protein eaten.</p>
  
  <p>I have already figured out how to get the kcal and protein amounts of a single recipe from the recipes sheet into the diary sheet using VLOOKUP():</p>
  
  <pre><code>=VLOOKUP(1;Table1;3;FALSE) //For kcal
  </code></pre>
  
  <p>but I really would like to automate this a bit. At this stage if I want to use this sheet I need to copy the whole function (and add a + prefix), paste it at the end and change the first parameter to the correct ID. Then I have to repeat this process also to the TOTAL_PROTEINS column (where I need to remember to change the source parameter from 3 to 4).</p>
  
  <p>I guess the optimal situation would be if the Diary sheet also had some EATEN_RECIPES column, where people could add a list of IDs (1,15,6) but I have no idea if this is possible in excel. The point is, I want to be able to write down an ID to diary and have excel automatically fetch the kcal and protein amounts from the recipes sheet and update the total amount in the diary.</p>
  
  <p>This is probably quite a simple matter, but I have no idea what search words to use in google, any comments on this are appreciated. (Also I need a better title.)</p>