Search code examples
excelexcel-formulaexcel-2010

Searching a specific data property, if true, add a different data element to current cell


Firstly, sorry if the question is worded badly. I will try my very best to explain.

As you can see in the screenshot below, I have a column with the name Size, that will either have the value 1500 or 1200. What I want to do is If the value of this is 1500, add the Weekly Losses (Cost) column value of the same row to the cell T33.

enter image description here

I have tried using multiple =IFs like =IF(Z8=1500, +T8, IF(Z9=1500, +T9)) but obviously when the first if statement if reached I believe it stops the formula and just populates it with the value of T8.

I have also tried looking at alternate options such as VLOOKUP, but I from what I have found this will also not work?

I'm unsure of the use of =IFS but could this be a solution?

Be greatly appreciated with any help provided, it has been one of those head wreaking moments for me.

Thanks


Solution

  • Thanks to @cybernetic.nomad for this simple solution.

    Anybody that is looking for something similar I will highlight what Ive done.

    The function SUMIF() solves this issue.

    • =SUMIF require 3 parameters which is detailed below.
    • =SUMIF(range of cells that are being evaluated, criteria(value youre looking for), sum-range the cells you are going to add up if criteria is met)

    Taking a look at my example I used the formula which worked perfectly!

    =SUMIF(Z8:Z23, 1500, T8:T23)