Find value in range considering multiple criteria

phmalu

Board Regular
Joined
Jun 21, 2017
Messages
52
Office Version
  1. 2019
Platform
  1. Windows
Hi all!

I'm facing a small problem to find values in this table considering multiple criteria.
The challenge is to fill values in J-M (just like I did manually) but using a formula instead. In order to do so I have to match the value in A for the row with the one in F (or G,H,I) and then find it somewhere in D or E. From there, the answer will be 2 columns left (B or C) and it is in the exact same row as the value in D or E. If the value is duplicate, the 1st entry in F-I has to match the first in D-E and so on (e.g. duplicates - F1 matches D4; G2 matches E4).

Note: Use value in F to find J; G to K; H to L...

Another exemple:
-Finding what to write in L6:
1. Because H matches L (and same row), first find H6 in D-E.
2. But don't forget the second criteria! Values in A have to be the same for all valid rows... hence, we can be sure H6 will be in D6:E7.
This is important because values in D-E are not unique and if A is not taken into account then it may give the wrong answer (e.g E2 and E7)
2. Finding H6 e in D6:E7.... H6 = D7
3. From D7, we know all answers will be in the same row but 2 columns to the left (fixed rule valid for the entire table): Value in B7 is the matching one (final answer). Hence, L6=B7

I hope this is enough for you all to understand the logic behind what I want. But be free to ask me for more details!
Ty you all in advance!
-P

VSF_test_070522.xlsx
ABCDEFGHIJKLM
1NO.CF1CF2CV1CV2S_CV1S_CV2S_CV3S_CV4VFS_1VFS_2VFS_3VFS_4
2136551538247139139247153849495536
31282639274721
414949139139
51707147985360
62504216117816117822724750424151
724151227247
83384362736273119102138434431
933132102179
103444611930
VSF_test
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try this in J2, copied across and down

22 07 05.xlsm
ABCDEFGHIJKLM
1NO.CF1CF2CV1CV2S_CV1S_CV2S_CV3S_CV4VFS_1VFS_2VFS_3VFS_4
2136551538247139139247153849495536
31282639274721    
414949139139    
51707147985360    
62504216117816117822724750424151
724151227247    
83384362736273119102138434431
933132102179    
103444611930    
Find value
Cell Formulas
RangeFormula
J2:M10J2=IFERROR(INDEX(FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,IF($A$2:$A$10=$A2,IF($D$2:$E$10=F2,$B$2:$C$10,""),""))&"</c></p>","//c"),COUNTIF($F2:F2,F2)),"")
 
Upvote 0
Solution
Try this in J2, copied across and down

22 07 05.xlsm
ABCDEFGHIJKLM
1NO.CF1CF2CV1CV2S_CV1S_CV2S_CV3S_CV4VFS_1VFS_2VFS_3VFS_4
2136551538247139139247153849495536
31282639274721    
414949139139    
51707147985360    
62504216117816117822724750424151
724151227247    
83384362736273119102138434431
933132102179    
103444611930    
Find value
Cell Formulas
RangeFormula
J2:M10J2=IFERROR(INDEX(FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,IF($A$2:$A$10=$A2,IF($D$2:$E$10=F2,$B$2:$C$10,""),""))&"</c></p>","//c"),COUNTIF($F2:F2,F2)),"")
Apparently it works just the way it should, thank you so much for your help!
I'm just wondering, is there any alternative solution without having to CSE? If it's going to be extra laborious, I don't need though.
Thank you!
 
Upvote 0
is there any alternative solution without having to CSE?
I don't have 2019 to test with but I thought that you might not need CSE with that version. In any case, whether you have to press CSE or not, the formula must actually process an array of values since that is what you are dealing with in each case. :)

If the sheet is 'sluggish' because of the formulas you could see if this makes a difference.
Excel Formula:
=IF(F2="","",IFERROR(INDEX(FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,IF($A$2:$A$10=$A2,IF($D$2:$E$10=F2,$B$2:$C$10,""),""))&"</c></p>","//c"),COUNTIF($F2:F2,F2)),""))
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,126
Members
452,381
Latest member
Nova88

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