Match (1 of 3 cell values) in a range?

R

RyanR

Wondering if it's possible to achieve the following without using OR's (i.e.
via array formula or similar)

I have product information in a straight data dump from our point of sale,
and a table of categories, suppliers or product groups to exclude from
further reports (in a single column list).

Such that:
D4 = Category
E4 = Supplier
I4 = Product group

I want a response:
If the category, or the supplier, or the product group is in the list of
exclusions, then response should be "DO NOT REPLENISH"

I can do it easily enough with a IF(OR(MATCH(D4......) [3 match
statements]),"DO NOT REPLENISH","OK") but wondering if there is a
nicer/cleaner way to do it

Thanks in advance.
 
T

T. Valko

D4 = Category
E4 = Supplier
I4 = Product group

You're going to need 2 tests since your criteria are not in a contiguous
range.

Here's one way.

Assuming the range to chack is A1:A20.

All on one line. Normally entered:

=IF(SUMPRODUCT(COUNTIF(A1:A20,D4:E4))
+COUNTIF(A1:A20,I4),"Do not replenish","do this")

Or, this array entered version (doesn't really gain you anything but it's a
couple of keystrkes shorter):

=IF(SUM(COUNTIF(A1:A20,D4:E4)
,COUNTIF(A1:A20,I4))
,"Do not replenish","do this")

--
Biff
Microsoft Excel MVP


RyanR said:
Wondering if it's possible to achieve the following without using OR's
(i.e.
via array formula or similar)

I have product information in a straight data dump from our point of sale,
and a table of categories, suppliers or product groups to exclude from
further reports (in a single column list).

Such that:
D4 = Category
E4 = Supplier
I4 = Product group

I want a response:
If the category, or the supplier, or the product group is in the list of
exclusions, then response should be "DO NOT REPLENISH"

I can do it easily enough with a IF(OR(MATCH(D4......) [3 match
statements]),"DO NOT REPLENISH","OK") but wondering if there is a
nicer/cleaner way to do it

Thanks in advance.
 
J

Jacob Skaria

Try the below array formula; with exclusions in range J1:J5

=IF(COUNT(MATCH(D4:F4,J1:J5,0)),"DO NOT REPLENISH","OK")
 
J

Jacob Skaria

Oops..I didnt notice the reference I4..corrected version/

'array entered
=IF(COUNT(MATCH(D4:F4,J1:J5,0),MATCH(I4,J1:J5,0)),"dafdas","OK")

--
Jacob


Jacob Skaria said:
Try the below array formula; with exclusions in range J1:J5

=IF(COUNT(MATCH(D4:F4,J1:J5,0)),"DO NOT REPLENISH","OK")

--
Jacob


RyanR said:
Wondering if it's possible to achieve the following without using OR's (i.e.
via array formula or similar)

I have product information in a straight data dump from our point of sale,
and a table of categories, suppliers or product groups to exclude from
further reports (in a single column list).

Such that:
D4 = Category
E4 = Supplier
I4 = Product group

I want a response:
If the category, or the supplier, or the product group is in the list of
exclusions, then response should be "DO NOT REPLENISH"

I can do it easily enough with a IF(OR(MATCH(D4......) [3 match
statements]),"DO NOT REPLENISH","OK") but wondering if there is a
nicer/cleaner way to do it

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top