Forum Discussion
Issue with Excel Product Function Syntax Using Multiple Logical Criteria
Environment: Windows 10, Microsoft® Excel® for Microsoft 365 MSO (16.0.14228.20216) 64-bit
Having a peculiar issue with the Product function, and hoping for some help.
Background:
The attached file is a simplified and cleansed extract of a much larger file I use to aggregate data and prep it for the Peltier charting application. Within it, I can select periods of various lengths (month, qtr, YTD through specified date). Based on the selection the file either uses the monthly data or compounds monthly data for longer periods. The PRODUCT formula for this I have written follows. Its intended effect is to zero out inapplicable periods through the 3 logical criteria (the variable is not a match, the period end date is before the specified period, the period end date is after the specified period) and compound applicable periods that remain.
=(PRODUCT( IF($B$5:$B$76 = $N5, IF($A$5:$A$76 >= VLOOKUP(Per_Name,Chart_Period,2,0), IF($A$5:$A$76 <= VLOOKUP(Per_Name,Chart_Period,3,0), C$5:C$76) / 10000 + 1) * CCF)) -1)
Where:
- B5:B76 is the column holding row leaders (variable names in the actual workbook)
- A5:A76 is the Period End Date for any month
- Per_Name is the period designation selected from a pulldown list using data validation
- Chart_Period is a table that provides the first and last EOM date for the selected periods, accessed through VLOOKUP
- CCF is a compounding correction factor that is set to 1 for the example, but is inclusion for purpose of completion.
- The formula is also effectively bypassed by other logic when reporting a single month period. I have not replicated that here to provide the most encompassing example.
The formula has worked as expected in my actual model to date for YTD 12/31/2020, individual months, YTD through Jan-June 2021, and Q1 2021. I have been experiencing problems, however, using it for Q2 2021. My testing reveals that the formula fails (returning a value of -100% whenever the first period matching the selection criteria is not January; the first period in my list. (for clarity, January 2021, YTD for any month and Q1 2021 work, but nothing else does). I have tested the logical criteria using the CountIFS function and can verify that it finds the correct number of arguments to the Product Function. This leads me to suspect that something is tripping up within the argument 'C$5:C$76) / 10000 + 1)', as this returning 0 for all selected periods would cause the formula to return -1.
Hoping someone can explain this and offer a syntax correction or work-around.
Thank you in advance for your consideration
Larry
1 Reply
- Detlef_LewinSilver Contributor
=PRODUCT(FILTER(C$5:C$76,(B$5:B$76=N20)*(A$5:A$76>=VLOOKUP(Per_Name,Chart_Period,2,0))*(A5:A76<=VLOOKUP(Per_Name,Chart_Period,3,0)))/10,000+1)-1