Matching on multiple criteria

Vikram J B

New Member
Joined
Jun 25, 2018
Messages
5
The Input Values to be entered ..IN F2 & F4. The Value in F2 needs to be searched in the array G14:K19 AND the value Entered in F4 needs to be searched in the array L14:P19. If both the values are found on the same Row and corresponding columns , We need the corresponding Model to be returned. There is an instance of F2 in K12 of the Head Range array but the corresponding cell to it in the Corresponding Discharge Value Array is P12 is not equal to F4 and hence needs to be ignored. Only the cells matching F2 head range array and F4 Matching cells lying in the same column and row no as F2 in the head Range should return the value of the model in column E


Criteria to Select Pumpsets
Input Head due to all causes110in Mtrs
Input Required Discharge400in LPM
Head RangeDischarge Range
SERIESMODELSTG1234512345
RE68RE68/03+ET075362605753470210300390480
RE68RE68/04+ET093482807670620210300390480
RE65RE65/05 + ET093598979694910150200250300
RE65RE65/06 + ET11261181161141131100150200250300
RE70RE70/06 + ET15061141111101091030300400500600
RE70RE70/07 + ET18771331291281271200300400500600

<tbody>
</tbody>
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
This?


Excel 2010
BCDEFGHIJKLMN
1Criteria to Select Pumpsets
2Input Head due to all causes110in MtrsRE70/06 + ET150
3
4Input Required Discharge400in LPM
5
6
7Head RangeDischarge Range
8SERIESMODELSTG1234512345
9RE68RE68/03+ET075362605753470210300390480
10RE68RE68/04+ET093482807670620210300390480
11RE65RE65/05 + ET093598979694910150200250300
12RE65RE65/06 + ET11261181161141131100150200250300
13RE70RE70/06 + ET15061141111101091030300400500600
14RE70RE70/07 + ET18771331291281271200300400500600
Sheet1


Code:
Sub findcell()
Dim c As Range
For Each c In Range("e9:n14")
If c = Range("d2") And c.Offset(0, 5) = Range("d4") Then
Range("g2") = Cells(c.Row, 3)
End If
Next c
End Sub
 
Upvote 0

Excel 2010
BCDEFGHIJKLMN
1Criteria to Select Pumpsets
2Input Head due to all causes110in MtrsRE70/06 + ET150
3
4Input Required Discharge400in LPM
5
6
7Head RangeDischarge Range
8SERIESMODELSTG1234512345
9RE68RE68/03+ET075362605753470210300390480
10RE68RE68/04+ET093482807670620210300390480
11RE65RE65/05 + ET093598979694910150200250300
12RE65RE65/06 + ET11261181161141131100150200250300
13RE70RE70/06 + ET15061141111101091030300400500600
14RE70RE70/07 + ET18771331291281271200300400500600
Sheet1
Cell Formulas
RangeFormula
G2=INDEX($C$9:$C$14,SUMPRODUCT(--($E$9:$I$14=D2)*--(OFFSET($E$9:$I$14,0,5)=D4)*ROW($E$9:$I$14))-8)
 
Upvote 0
Thanks very much .... But what is the -8 at the end of the formula ...

Is it OK to simply copy and past the formula to the excel sheet ? or do i need to do anything else, as i am getting a ref# error.

Incase I need to search for multiple value meeting the 2 input Criterias, then how do i find it from 10000+ records like this.

Thanks in advance ...
 
Upvote 0
The header above is in row 8, otherwise subtract a different number (be sure the columns line up also to avoid error messages). I wrote a macro first in case you have multiple values. Formulas won't work well with 10000+ records unless you're willing to put the data in a normal (1 to 1) structure.
 
Last edited:
Upvote 0
Here's the code for multiple rows:

Code:
Sub findcell()
Dim c As Range, x%
x = 0
For Each c In Range("e9:n14")
If c = Range("d2") And c.Offset(0, 5) = Range("d4") Then
Range("p2").Offset(x) = Cells(c.Row, 3)
x = x + 1
Else
End If
Next c
End Sub

If you want to try a formula, something like:


Excel 2010
BCDEFGHIJKLMNOP
1Criteria to Select PumpsetsRE68/04+ET093
2Input Head due to all causes110in MtrsRE70/06 + ET150
3
4Input Required Discharge400in LPM
5
6
7Head RangeDischarge Range
8SERIESMODELSTG1234512345
9RE68RE68/03+ET075362605753470210300390480
10RE68RE68/04+ET0934828076701100210300390400
11RE65RE65/05 + ET093598979694910150200250300
12RE65RE65/06 + ET11261181161141131100150200250300
13RE70RE70/06 + ET15061141111101091030300400500600
14RE70RE70/07 + ET18771331291281271200300400500600
Sheet1 (3)
Cell Formulas
RangeFormula
P1{=INDEX($C$9:$C$14,SMALL(IF($E$9:$I$14=$D$2,IF(OFFSET($E$9:$I$14,0,5)=$D$4,ROW($E$9:$I$14))),ROW(A1))-8)}
Press CTRL+SHIFT+ENTER to enter array formulas.


which might be slow
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,520
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top