Return value based on multiple tests

Weaseltron

New Member
Joined
Jan 24, 2017
Messages
4
Hi all

This might be a simple request but I cant think of a neat way to do it.

Lets say I have the following table A:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Attachment Name
[/TD]
[TD]Value1
[/TD]
[TD]Value2
[/TD]
[TD] Value3
[/TD]
[TD]Value4
[/TD]
[TD]Value5
[/TD]
[/TR]
[TR]
[TD]file1
[/TD]
[TD]10
[/TD]
[TD]15
[/TD]
[TD]20
[/TD]
[TD]0
[/TD]
[TD]50
[/TD]
[/TR]
[TR]
[TD]file2
[/TD]
[TD]20
[/TD]
[TD]25
[/TD]
[TD]25
[/TD]
[TD]10
[/TD]
[TD]10
[/TD]
[/TR]
[TR]
[TD]file3
[/TD]
[TD]25
[/TD]
[TD]50
[/TD]
[TD]50
[/TD]
[TD]5
[/TD]
[TD]0
[/TD]
[/TR]
</tbody>[/TABLE]

and table B

[TABLE="width: 500"]
<tbody>[TR]
[TD]Client Name
[/TD]
[TD]Value1
[/TD]
[TD]Value2
[/TD]
[TD]Value3
[/TD]
[TD]Value4
[/TD]
[TD]Value5
[/TD]
[TD]Attachment to be used
[/TD]
[/TR]
[TR]
[TD]ClientA
[/TD]
[TD]10
[/TD]
[TD]15
[/TD]
[TD]20
[/TD]
[TD]0
[/TD]
[TD]50
[/TD]
[TD]
?
[/TD]
[/TR]
[TR]
[TD]ClientB
[/TD]
[TD]20
[/TD]
[TD]25[/TD]
[TD]25[/TD]
[TD]10
[/TD]
[TD]10[/TD]
[TD]
?​
[/TD]
[/TR]
[TR]
[TD]ClientC
[/TD]
[TD]30
[/TD]
[TD]15
[/TD]
[TD]15
[/TD]
[TD]15
[/TD]
[TD]15
[/TD]
[TD]
?
[/TD]
[/TR]
</tbody>[/TABLE]

What I am trying to do is find a formula to populate the "Attachment to be used" column.

This will need to compare the Value1, Value2 etc fields for each client to the Value1, Value2 etc fields for each attachment file and select the one that matches. It must be a 100% match for each value.

IF the values for a client match exactly the values for a particular attachment it should return that file name (ClientA = file1, ClientB = file2)
IF the vales for a client do not match exactly to an attachment it should return "no match" or something similar (ClientC)

Thanks in advance!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
To make it clearer, there could be multiple attachments with the same value for, say, Value1. The formula in table B will have to return the attachment name based on an exact match for every Value.
 
Upvote 0
Hi,

Here one way, Array formula to be confirm with CSE (Control, Shift, Enter), see instructions below:


Book1
ABCDEFG
1Attachment NameValue1Value2Value3Value4Value5
2file1101520050
3file22025251010
4file325505050
5
6
7Client NameValue1Value2Value3Value4Value5Attachment to be used
8ClientA101520050file1
9ClientB2025251010file2
10ClientC3015151515No Match
Sheet279
Cell Formulas
RangeFormula
G8{=IFERROR(INDEX(A$2:A$4,MATCH(B8&C8&D8&E8&F8,B$2:B$4&C$2:C$4&D$2:D$4&E$2:E$4&F$2:F$4,0)),"No Match")}
Press CTRL+SHIFT+ENTER to enter array formulas.


Formula copied down.
 
Upvote 0
Hi,

Here one way, Array formula to be confirm with CSE (Control, Shift, Enter), see instructions below:

ABCDEFG
Attachment NameValue1Value2Value3Value4Value5
file1
file2
file3
Client NameValue1Value2Value3Value4Value5Attachment to be used
ClientAfile1
ClientBfile2
ClientCNo Match

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]20[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]25[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]50[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]20[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]30[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]

</tbody>
Sheet279

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G8[/TH]
[TD="align: left"]{=IFERROR(INDEX(A$2:A$4,MATCH(B8&C8&D8&E8&F8,B$2:B$4&C$2:C$4&D$2:D$4&E$2:E$4&F$2:F$4,0)),"No Match")}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]



Formula copied down.

Well thats absolutely glorious! Thank you so much, you've made my day!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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