I am attempting to identify a subset of a range based on TRUE FALSE statements. An example is in the following chart below.
FALSE FALSE 1.21147
TRUE FALSE 1.20984
FALSE FALSE 1.21083
FALSE FALSE 1.210315
FALSE TRUE 1.21151
FALSE FALSE 1.21335
FALSE FALSE 1.213515
FALSE FALSE 1.212435
TRUE FALSE 1.212125
FALSE FALSE 1.21226
In this scenario I want a subset to be identified based on alternating TRUE statements. In the left side column the first TRUE statement would trigger the beginning of the subset an the TRUE statement in the second column would trigger the end of the subset. I then want to use a simple max function to identify the MAX in the third column. I would use an IF statement to determine whether or not the first TRUE statement is correct however, i am unable to figure out how to identify the subset of the range based on the TRUE statement in the second column. I also want to know whether or not this works from going from the top to the bottom if the statement could possible work going the bottom to the top. Any help would be most appreciated.
Part 1 can be done using a combination of
MATCH,OFFSETandMAXFor this example I’ve assumed your data is located starting at cell
A2.For the sake of clarity I use some intermediate results in cells
E1:E4. If you prefer a single formula, simply merge the intermediate formula into the final formulaCell
E2= position of firstTRUEin columnACell
E3= position of firstTRUEin columnBResult formula, Max value in column
Cbetween the rows found inE2andE3(inclusive)Part 2 is more tricky: I don’t think you can search up a range for a value. However, looking at your data it may be OK to search down for the second
TRUE? If this is OK then:Cell
E4= position of secondTRUEin columnAOr this, entered as an array formula (Insipred by Barry) which will get the last
TRUEin the columnResult formula, Max value in column
Cbetween the rows found inE3andE4(inclusive)