AGGREGATE Function With Errors

excelbytes

Active Member
Joined
Dec 11, 2014
Messages
291
Office Version
  1. 365
Platform
  1. Windows
I have this formula:

=AGGREGATE(9,6,LEFT(OFFSET('Form Responses'!$K$1,1,MATCH('ORDER QTY TOTALS'!B63,'Form Responses'!$L$1:$DI$1,0),COUNTA('Form Responses'!A:A),1),1)*12)

The array of the formula resolves to:

{12;#VALUE!;24;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!;24;#VALUE!;#VALUE!;#VALUE!;#VALUE!;#VALUE!}

I'm trying to convert the number of dozens to units (e.g. 5 dozen = 60)

I'm not sure why this isn't working.

The range that is returned by the OFFSET function is:

1 DOZEN
2 DOZEN
2 DOZEN
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I was hoping someone would have an answer to this. In my experience AGGREGATE seems to ignore errors if it's already in the source, but if the errors are in an array created within the AGGREGATE function like your example, it doesn't seem to ignore them. I ran into a similar situation the other day.
 
Upvote 0
The aggregate function only works with an array if the 1st argument is 14 or higher. With 13 or lower you need to use a range.
Can you post some sample data using the XL2BB add-in
 
Upvote 0
The aggregate function only works with an array if the 1st argument is 14 or higher. With 13 or lower you need to use a range.
Can you post some sample data using the XL2BB add-in
AGGREGATE - Dozen Conversion.xlsm
ABCDEFGHIJKLMNOPQ
1Order DateItem 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Correct Responses
210-21-2024 10:55:461 DOZEN1 DOZEN1 DOZEN1 DOZEN1 DOZEN1 DOZEN1 DOZEN1 DOZEN1 DOZEN1 DOZENItem 1#VALUE!60
310-21-2024 12:22:54Item 2#VALUE!12
410-21-2024 15:45:512 DOZEN1 DOZENItem 3#VALUE!24
510-21-2024 18:39:21Item 4#VALUE!24
610-21-2024 18:49:07Item 5#VALUE!24
710-21-2024 18:58:24Item 6#VALUE!24
810-21-2024 19:26:15Item 7#VALUE!24
910-21-2024 19:30:15Item 8#VALUE!60
1010-21-2024 19:40:03Item 9#VALUE!12
1110-21-2024 20:32:35Item 10#VALUE!12
1210-21-2024 20:42:201 DOZEN1 DOZEN
1310-21-2024 20:48:17
1410-21-2024 21:08:02
1510-21-2024 21:24:491 DOZEN1 DOZEN
1610-21-2024 21:35:43
1710-21-2024 23:01:481 DOZEN1 DOZEN1 DOZEN
1810-22-2024 0:34:172 DOZEN1 DOZEN
1910-22-2024 5:04:49
2010-22-2024 6:29:35
2110-22-2024 7:06:52
2210-22-2024 7:28:55
Sheet1
Cell Formulas
RangeFormula
N2:N11N2=AGGREGATE(9,6,LEFT(OFFSET($A$1,1,MATCH(M2,$B$1:$K$1,0),COUNTA(A:A),1),1)*12)
 
Upvote 0
Thanks for that, how about
Excel Formula:
=SUM(FILTER(LEFT($B$2:$K$1000&"0"),$B$1:$K$1=M2)*12)
 
Upvote 0
Solution
Thanks for that, how about
Excel Formula:
=SUM(FILTER(LEFT($B$2:$K$1000&"0"),$B$1:$K$1=M2)*12)
That works great! Can you explain how the "LEFT($B$2:$K$1000&"0")" component works?
 
Upvote 0
It adds a 0 to the end of every cell, so that the empty cells have a 0 in them & the Left function returns the 1st character.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Another option (still assuming all values < 10 dozen) would be
Excel Formula:
=SUM(TOCOL((B$1:K$1=M2)*LEFT(B$2:K$22)*12,3))

.. or if you wanted all the results without copying the formula down the column
Excel Formula:
=BYROW(M2:M11,LAMBDA(r,SUM(TOCOL((B1:K1=r)*LEFT(B2:K22)*12,3))))
 
Upvote 0

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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