Aggregate Function's Array Argument Gives VOLATILE formula result when using concatenation for Named Range

DR RENO

Board Regular
Joined
Jun 29, 2018
Messages
65
Need experts help on this after racking brain over and over. I have a data sheet, 'DATA', that contains Product and Pricing detail by row. Each row will have a column for Product Name (ie. Product A, Product B, Product C....etc), and a column for Location, (ie.Location 1, Location 2, Location 3....etc.) On another worksheet, I have a table that's a pricing schedule, 'PRICING SCHEDULE', for each product at each location. I've created a Named Range for each Product/Location line on the Pricing Schedule based on the previous product and location name example I gave looks like this: PRODA1, PRODB2, PRODC3. The pricing schedule will have the Price for the Product/Location combo.

The same product can be sold at multiple locations with a different price for each. So it will need a unique name in order to obtain the correct value. I'm using the Aggregate function in order to avoid having a longer formula with multiple IF Statements and And/OR operators. I'm just having trouble with the Aggregate functions array argument.

Aggregate works perfectly if I just directly type in the named range, but unfortunately, I have a dynamic file so I'm needing to reference in each data row the product and location to obtain the correct value from the other sheet. This has me creating a concatenation where I combine LEFT function to get the 1st 4 characters of the Product Name field and RIGHT function for the last character on both the Product Name field and the Location Name field. So for a row where the product is, 'Product B' for location 'Location 4', I get a concatenation of, ProdB4 which I have a named range setup as in the Pricing Schedule. Unfortunately, when I reference the cell that contains the concatenation, it generates a VOLATILE formula result. It also generates a Volatile formula result when entering the concatenation directly into the function's array argument. Here is my formula:

AGGREGATE(15,6,INDIRECT(CONCATENATE(LEFT(B2,4)&RIGHT(B2,1)&RIGHT(H2,1))/(CONCATENATE(LEFT(B2,4)&RIGHT(B2,1)&RIGHT(H2,1)))>$P2),1)


If I just type in PRODB4 where I am referencing my named range, the formula works perfectly, as the formula result give me a value. Again, I know there might be another formula option, but I don't want to get into a long IF statement, so would really need to keep using AGGREGATE. I am open to renaming the Named Ranges if you have a better suggestion, as well as obviously any formula changes you recommend.

Any help you can give with this will be greatly appreciated


 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I have to leave now - I'll try to help later. In the meantime try a formula with no structured references.

M.
 
Upvote 0
I've tried multiple modifications, but cannot get formula to cap on Largest value from array. Please let me know if you have another solution when you get a chance. Thanks. It's really close, except for that final piece.
 
Upvote 0
I'm confused - what exactly do you mean by "to cap the largest value from array"?

Try to show us the expected results (fill the cells with ?) and the logic to achieve such results.

Q
R
S
T
1
Proposed Year 2​
Proposed Year 3​
Proposed Year 4​
Proposed Year 5​
2
?​
?​
?​
?​
3
?​
?​
?​
?​
4
?​
?​
?​
?​
5
?​
?​
?​
?​
6
?​
?​
?​
?​
7
?​
?​
?​
?​
8
?​
?​
?​
?​

<tbody>
</tbody>


M.
 
Upvote 0
Hi Marcelo,

Thanks for responding. Year10 on the Pricing Schedule is the highest price that should be on the data sheet's Proposed Year for the applicable Position and Location. Year 1 is the only column that can have a higher price since they transacted on it. Therefore there will be no price increase in the following years. If Year 1 is below the max price from Year 10 in Pricing Schedule, it increases will be the next highest in accordance to the pricing schedule. The formula solution you have provides that. The remaining issue is when that pricing increment has reached the max before Year4 in Datasheet, instead of getting a number error we just need the same value from prior year carried forward. Here is an example

Pricing schedule
A
B
C
DEF
1
Product​
Location​
Year1​
Year2Year3Year4
2
Product A​
Location 1​
100110115120
3
Product A​
Location 2​
150175200225
4
Product A​
Location 3​
200210215220
5
Product B​
Location 1​
95105120135
6
Product B​
Location 2​
160200240280
7
Product B​
Location 3​
205210215220
8
Product C​
Location 1​
110115120125
9
Product C​
Location 2​
148150160170

<tbody>
</tbody>

DATA Sheet

A
B
C
DEF
1
Product​
Location​
Year1​
Year2Year3Year4
2
Product A​
Location 1​
112115120120
3
Product A​
Location 2​
190200225225
4
Product A​
Location 3​
217220220220
5
Product B​
Location 1​
110120135135
6
Product B​
Location 2​
160200240280
7
Product B​
Location 3​
240240240240
8
Product C​
Location 1​
110115120125
9
Product C​
Location 2​
148150160170

<tbody>
</tbody>

I've tried putting in IF Statements, but could not get it to carry across. The tricky part, at least for me, is having the Position and location difference, where it will either use cell D2 or E2 depending on if it's a variable position or fixed price, in the file I had sent earlier.

Hopefully this clarifies a little better, but let me know if you need additional information. Thanks again for your help
 
Last edited:
Upvote 0
Let me clarify something after rereading my last message. The cell D2 or E2 reference has already been identified by your formula, so you're already grabbing the correct row in the Pricing Schedule. I shouldn't have said you will "either use cell D2 or E2" as your formula already has identified that. Apologize for adding confusion.
 
Upvote 0
Question
I'm assuming that the column C in Data sheet (Year1) is given.
If so, should the formulas calculate only the columns Year2, Year3 and Year4, right?

M.
 
Last edited:
Upvote 0
Technically correct. I have a formula in column C which is correctly capturing the applicable value(s). This will just be Year2 and outter years (year 3, year 4...etc)
 
Upvote 0
Try

DATA sheet

A
B
C
D
E
F
1
Product​
Location​
Year1​
Year2​
Year3​
Year4​
2
Product A​
Location 1​
112​
115​
120​
120​
3
Product A​
Location 2​
190​
200​
225​
225​
4
Product A​
Location 3​
217​
220​
220​
220​
5
Product B​
Location 1​
110​
120​
135​
135​
6
Product B​
Location 2​
160​
200​
240​
280​
7
Product B​
Location 3​
240​
240​
240​
240​
8
Product C​
Location 1​
110​
115​
120​
125​
9
Product C​
Location 2​
148​
150​
160​
170​

Formula in D2 copied across and down
=IFERROR(AGGREGATE(15,6,'Pricing Schedule'!$C$2:$F$9/(('Pricing Schedule'!$A$2:$A$9=$A2)*('Pricing Schedule'!$B$2:$B$9=$B2)*('Pricing Schedule'!$C$2:$F$9>C2)),1),C2)

M.
 
Upvote 0

Forum statistics

Threads
1,215,698
Messages
6,126,270
Members
449,308
Latest member
VerifiedBleachersAttendee

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