Help with Lookup Aggregate formula to include multiple IF

MarcBK

New Member
Joined
Apr 19, 2021
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
Hello all,

I am using the following formula to lookup when the last stocktake date of product range has been done. This formula triggers its date off the keyword "Stocktake" in column F. It falls over when a random stocktake is done on a separate product though for instance if stocktake is done on product B at a different date to product A. So I need to work out how to include an if statement to show if product name is listed in column a then run the lookup formula.

Excel Formula:
=LOOKUP(2,1/($A$6:$A$1000=AGGREGATE(14,6,$A$6:$A$1000/($F$6:$F$1000="Stocktake"),1)),$A$6:$A$81000)


Product A In
Excel Formula:
=SUMIF($B$6:B1000,"Product A",$C$6:C1000)+SUMIF($B$6:B1000," Product A",$",$E$6:E1000)-$G$3
Product B In
Excel Formula:
=SUMIF($B$6:B1000,"Product B",$C$6:C1000)+SUMIF($B$6:B1000," Product B",$",$E$6:E1000)-$G$3
Product A Out
Excel Formula:
=SUMIF(B:B,"Product A",D:D)
Product B Out
Excel Formula:
=SUMIF(B:B,"Product B",D:D)
Last Stocktake date Product ANew Formula with IF Product A in column B then return last stocktake date of product ALast Stocktake date Product BNew Formula with IF Product B in column B then return last stocktake date of product B

So what I am hoping to do is trigger it when product in column B matches by name. If Product A in Column B and Stocktake in Column F return date from Column A. I will need to seperate out the lookup for the different products as shown above but I do not know how to include the if statement for the product lookup in column B.

DateProductIn From SupplyOutIn from OtherNotes
11/8/22Product A50
10/10/22Product B65
12/10/22Product C120
18/11/22Product B15
22/11/22Product A18
1/12/22Product A30
1/12/22Product B6Stocktake
8/12/22Product C5Stocktake
16/1/23Product A2Stocktake

All help is greatly appreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Is this what you are trying to do?

22 12 01.xlsm
ABCDEFGHI
1DateProductIn From SupplyOutIn from OtherNotesProductLast Stocktake
211/08/2022Product A50Product A16/01/2023
310/10/2022Product B65Product B1/12/2022
412/10/2022Product C120Product C8/12/2022
518/11/2022Product B15
622/11/2022Product A18
71/12/2022Product A30
81/12/2022Product B6Stocktake
98/12/2022Product C5Stocktake
1016/01/2023Product A2Stocktake
Stocktake
Cell Formulas
RangeFormula
I2:I4I2=AGGREGATE(14,6,A$2:A$10/((B$2:B$10=H2)*(F$2:F$10="Stocktake")),1)
 
Upvote 0
Is this what you are trying to do?

22 12 01.xlsm
ABCDEFGHI
1DateProductIn From SupplyOutIn from OtherNotesProductLast Stocktake
211/08/2022Product A50Product A16/01/2023
310/10/2022Product B65Product B1/12/2022
412/10/2022Product C120Product C8/12/2022
518/11/2022Product B15
622/11/2022Product A18
71/12/2022Product A30
81/12/2022Product B6Stocktake
98/12/2022Product C5Stocktake
1016/01/2023Product A2Stocktake
Stocktake
Cell Formulas
RangeFormula
I2:I4I2=AGGREGATE(14,6,A$2:A$10/((B$2:B$10=H2)*(F$2:F$10="Stocktake")),1)
Kind of, but not quite.

My required formula to lookup product and return last date based on keyword 'stocktake' is in cell G4.

date is column A6:A1000
'stocktake' keyword could be found column anywhere in G6:G1000
Product in column B6:B1000

example: If Product A in B6 has keyword 'stocktake' in G6 then return date from A6

but then if later on in the sheet for Product A (for this example we will go Product A is in B380 and also has keyword stocktake in G380 then return date from A380 instead of the above A6. if that makes sense.
 
Upvote 0
'stocktake' keyword could be found column anywhere in G6:G1000
Previously you said "Stocktake" was in column F.

In your sample data the dates are in chronological order down column A. Is that the case with your real data?
If so, then apart from slight changes to the placement and sizes of the ranges, in what way is my existing formula failing?

MarcBK.xlsm
ABGHI
2
3ProductLast Stocktake
4Product A21/02/2023
5DateProductNotes
611/08/2022Product A
710/10/2022Product B
812/10/2022Product C
918/11/2022Product B
1022/11/2022Product A
111/12/2022Product A
121/12/2022Product BStocktake
138/12/2022Product CStocktake
1416/01/2023Product AStocktake
1525/01/2023Product B
163/02/2023Product C
1712/02/2023Product B
1821/02/2023Product AStocktake
192/03/2023Product A
20
Stocktake
Cell Formulas
RangeFormula
I4I4=AGGREGATE(14,6,A$6:A$1000/((B$6:B$1000=H4)*(G$6:G$1000="Stocktake")),1)
 
Upvote 0
Solution
Previously you said "Stocktake" was in column F.

In your sample data the dates are in chronological order down column A. Is that the case with your real data?
If so, then apart from slight changes to the placement and sizes of the ranges, in what way is my existing formula failing?

MarcBK.xlsm
ABGHI
2
3ProductLast Stocktake
4Product A21/02/2023
5DateProductNotes
611/08/2022Product A
710/10/2022Product B
812/10/2022Product C
918/11/2022Product B
1022/11/2022Product A
111/12/2022Product A
121/12/2022Product BStocktake
138/12/2022Product CStocktake
1416/01/2023Product AStocktake
1525/01/2023Product B
163/02/2023Product C
1712/02/2023Product B
1821/02/2023Product AStocktake
192/03/2023Product A
20
Stocktake
Cell Formulas
RangeFormula
I4I4=AGGREGATE(14,6,A$6:A$1000/((B$6:B$1000=H4)*(G$6:G$1000="Stocktake")),1)
but how does this show if product B or product C dates?
 
Upvote 0
Oh forget me. Moment of terrible judgement. Just actually look at it. Whoops.
 
Upvote 0
@MarcBK
I have removed the 'Mark as solution' mark from post #7 as clearly it is not the solution to your question. That should be used to mark the actual post that contains the solution to you question to help future readers. If no post contains the solution then don't mark any.
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

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