VBA code for SUMIFS?

后端 未结 3 1574
眼角桃花
眼角桃花 2020-12-22 02:34

I\'m trying to write a custom function that will let me retrieve a cell from the first row in a range that meets x number of criteria. I imagine this would be very similar t

3条回答
  •  甜味超标
    2020-12-22 03:07

    Deeno, having a UDF for this is very useful but you could also use plain old =VLOOKUP().

    VLOOKUP() only works by looking up one "key" but you can make a concatenated key in a helper column to the left. eg:

    W X Y Z    AA
    a b 6 ab6  1
    a b 7 ab7  2
    b b 7 bb7  3
    

    Then =VLOOKUP(A1,$Z$1:$AA$3,2,FALSE) if A1 had the value you are looking for. If your data is more complicated you could join the data with an unused character (eg: a pipe) so you have a|B|6 instead of ab6.

提交回复
热议问题