Logic Statements on Contains Function

Andrew_UK

Board Regular
Joined
Jun 3, 2015
Messages
53
Hi All,

I need a formula which tells me if another table contains a row which matches my criteria (if it helps I expect either 1 match or none)

Table 1 includes a tab which shows Invoice Month

[TABLE="width: 500"]
<tbody>[TR]
[TD]Customer[/TD]
[TD]Invoice Month[/TD]
[TD]Other Data[/TD]
[TD]Discount Entitled[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Table 2 shows whether or not this customer is in

[TABLE="width: 500"]
<tbody>[TR]
[TD]Customer[/TD]
[TD]Discount Start[/TD]
[TD]Discount End[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


So for instance the discount entitlement needs to read something like True/Fals and I imagine the formula will be along the lines of...

Contains(Table2, Customer, Customer, Invoice Month >= Related(Discount Start), Invoice Month <= Related(Discount End))

But I can't seem to get it working. The two tables are linked by customer

Thanks in advance for your help!!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
An "Events in Progress" pattern should apply here.

You could adapt Chris Webb's pattern here.
Also discussed in this paper on SQLBI (see page 27 for the optimized pattern).
 
Upvote 0

Forum statistics

Threads
1,224,106
Messages
6,176,380
Members
452,726
Latest member
HaploTheGreat

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