问题
I have an excel spreadsheet to keep track of project activities.
In Column A I have the Project Name and it repeats several times because the same project has several activities.
In Column B I have the Activities related to that project.
In Column C I have the % Complete of each activity.
What I would like to accomplish is: in Column D return the first Activity of the Project that is not 100%.
Here is a picture of what I would like to accomplish:
I was trying this formula with no luck:
=INDEX($B$2:$B$19,MATCH(TRUE,INDEX($C$2:$C$19<>100%,),0))
Then I found this one posted here:
Return smallest unique value that meets criteria
and here:
multiple criteria small function excel
But I haven't been able to get them to do what I want. Any help would be much appreciated.
Thanks
回答1:
For what it's worth, here is a slightly more accurate formula than @AlexisOlson's:
=INDEX($B$2:$B$19,MATCH(1,($A$1:$A$19=A2)*($C$1:$C$19<>1),0))
Typically, it is not a good idea to have concatenations within MATCH
because it may lead to incorrect results.
For example:
= MATCH("12"&"34",{"1","12"}&{"234","34"},0)
This formula would return 1 when you would actually want it to return 2.
Changing to this:
= MATCH(1,({"1","12"}="12")*({"234","34"}="34"),0)
Will remove any risk of falsely picking the wrong lookup values.
Of course, in this particular case, it makes no difference, because there is no possible way that $C$1:$C$19<>1
could return anything other than TRUE
or FALSE
, but it is just something to be aware of.
The only time I will use the &
approach inside MATCH
is if I actually desire to find the concatenation of strings in a single range, e.g. something like:
= MATCH("John"&" "&"Doe",{"John Doe","Bill Miller","Mike Jones"})
回答2:
You need to match on two conditions, the Project and the percent:
=INDEX($B$2:$B$19, MATCH(A2&TRUE, $A$1:$A$19&($C$1:$C$19 <> 1), 0))
This needs to be entered as an array formula using Ctrl+Shift+Enter in the formula box.
来源:https://stackoverflow.com/questions/48811811/how-to-return-row-value-that-meets-two-criteria-in-excel