# Calculation based on a search criteria in VBA

• ### Question

• 'm really stuck with this problem and not sure how to handle it.

Here is the problem:

1. I have a workbook with 5 sheets.
2. In sheet 2, I should search for a text in a col, lets say "COMPATIBLE" in col "E:E" and "Pass" in "O:O".
3. For this matching criteria, there will be certain values to it under "M:M". (numbers in black and red color)
4. This values should be copied into sheet 5 "D" col.
5. Then the below formula should be applied for the col A,B,C,D in sheet 5 (sheet A B C will already have some values)

``````=PERCENTILE.INC(\$X\$2:\$AA\$50,99%)
=PERCENTILE.INC(\$X\$2:\$AA\$50,90%)
=PERCENTILE.INC(\$X\$2:\$AA\$50,50%)``````
6. The OP of formulae one should go in sheet 1 A4, and formulae 2 into A5, A6.
7. And the last part is, for the values in "red" should be ignored from the calculation and the result should be give in sheet 5 in any 3 cells.

I know it's complicated, but i'm totally stuck with this. Any help would be really great.

Tuesday, January 10, 2017 3:54 PM

### All replies

• Any inputs?
Wednesday, January 11, 2017 3:58 PM