Double Condition (where sumproduct won't work)

Guanjin Peter

Active Member
Joined
May 21, 2008
Messages
429
my table is something like below:
my program sheet looks something like this:
I need a double condition formula to check the date, if matches the date Column (A), and matches product Column (b), then returns Column (C) which is the doc#.
I Could easily do it if it is a sum product formula, but in this case, it is alpha numberic.

date: 14 Jun (dd / mm)
product -- Doc#
apple ---- ac21 (so what formula do I put here?)
Orange --- abc2 (formula?)


date --- product --- Doc#
12 Jun -- apple ----- abc1
12 Jun -- Orange --- ab12
14 JUn -- Apple ----- ab21
14 Jun -- Orange ---- abc2
 
oh...I understand now...because I got duplicate entries for product and date:
That causes the formula not to work, even with different doc#...
That's right.

So what result would you be wanting if you were looking at 14-Jun and Apple?
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
return the the doc#, but i wasn't prepared for same date and product and different doc#. I got a shock too :)
 
Upvote 0
in Column H(db sheet), it stores all the doc#, it may be the same and it may be different. This gonna be a headache for me....

thanks alot for your reply! :)
Below is the full db table (sorry if this is what you want to see, I thought it wasn't required)
user1.xls
ABCDEFGHIJ
1DeliveryDate(dd/mm/yy)MonthsCustomerOutletCustomerIDProductIDProductExternalDoc#QtyUom
201-07-08JuneOrderTemplateBURGERKING--BEDOKC0127-09VFG-20247WHOLETOMATO-BKabc13KG
301-07-08JuneOrderTemplateBURGERKING--BEDOKC0127-09VFG-20127ONIONRINGcba24PKT
401-07-08JuneOrderTemplateBURGERKING--AMARAC0127-08VFG-20127ONIONRINGabc1234PKT
501-07-08JuneOrderTemplateBURGERKING--AMARAC0127-08VFG-20188SHREDDEDLETTUCE(BK)def4565PKT
630-06-08JuneOrderTemplateBURGERKING--AMARAC0127-08VFG-20247WHOLETOMATO-BKbbb5KG
731-06-2008JuneOrderTemplateBURGERKING--AMARAC0127-08VFG-20127ONIONRINGaaa5PKT
db
 
Last edited:
Upvote 0
=LOOKUP(2,1/((A1:A13=F2)*(B1:B13=F3)),C1:C13)

aladin: that didn't work for me, returns a N/A#

This is set up for the exhibit Jon posted. So, you need to adjust it to your layout. Btw, it will return #N/A if at least one lookup value (F2 or F3) is absent...
 
Upvote 0
I was thinking of a workaround. I came up with this:

if date(in db sheet, column A) match b2 AND product(db sheet, Column D) match b7,
return row number
then index, return column H of that row.
Can anyone help me with the formula?
 
Upvote 0
I was thinking of a workaround. I came up with this:

if date(in db sheet, column A) match b2 AND product(db sheet, Column D) match b7,
return row number
then index, return column H of that row.
Can anyone help me with the formula?
To me you still haven't made it clear what result you want if multiple rows match the date and product.

For example, if the date of interest is 14-Jun and product of interest is Apple, then for the sheet below, which of these 4 results do you want on your other sheet?

a) ab21
b) xyz
c) both ab21 and xyz
d) nothing?

Excel Workbook
ABCDEFGH
1dateproductDoc#
212-JunAppleabc1
312-JunOrangeab12
414-JunAppleab21
514-JunOrangeabc2
614-JunApplexyz
7
db
 
Upvote 0
Hi Peter_SSS, Sorry for late reply. I just checked. Can assume Doc# will be the same it date and product is the same. So it means by table assumption is wrong. So it should be like this:

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 10pt; FONT-FAMILY: Arial,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD></TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD style="TEXT-ALIGN: right">date </TD><TD></TD><TD></TD><TD>product</TD><TD></TD><TD></TD><TD></TD><TD>Doc#</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="TEXT-ALIGN: right">12-Jun</TD><TD></TD><TD></TD><TD>Apple</TD><TD></TD><TD></TD><TD></TD><TD>abc1</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="TEXT-ALIGN: right">12-Jun</TD><TD></TD><TD></TD><TD>Orange</TD><TD></TD><TD></TD><TD></TD><TD>ab12</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD style="TEXT-ALIGN: right">14-Jun</TD><TD></TD><TD></TD><TD>Apple</TD><TD></TD><TD></TD><TD></TD><TD>ab21</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</TD><TD style="TEXT-ALIGN: right">14-Jun</TD><TD></TD><TD></TD><TD>Orange</TD><TD></TD><TD></TD><TD></TD><TD>abc2</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</TD><TD style="TEXT-ALIGN: right">14-Jun</TD><TD></TD><TD></TD><TD>Apple</TD><TD></TD><TD></TD><TD></TD><TD>ab21</TD></TR></TBODY></TABLE>

But doc# can be different, if date is different but same product.
I'm really sorry Peter for the changes, I didn't expect this until now.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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