BYCOL and LAMBDA

Ashish Mathur

New Member
Joined
Mar 10, 2013
Messages
40
Office Version
  1. 365
Platform
  1. Windows
Hi,
Assume this data is in range A1:M8. Months are in B1:M1 and products are in A2:A8. As you can see, products get repeated in A2:A8.

ProductSepOctNovDecJanFebMarAprMayJunJulAug
A
1​
2​
3​
4​
5​
6​
7​
8​
9​
10​
11​
12​
B
2​
3​
4​
5​
6​
7​
8​
9​
10​
11​
12​
13​
C
3​
4​
5​
6​
7​
8​
9​
10​
11​
12​
13​
14​
A
4​
5​
6​
7​
8​
9​
10​
11​
12​
13​
14​
15​
B
5​
6​
7​
8​
9​
10​
11​
12​
13​
14​
15​
16​
D
6​
7​
8​
9​
10​
11​
12​
13​
14​
15​
16​
17​
A
7​
8​
9​
10​
11​
12​
13​
14​
15​
16​
17​
18​

In cell A11, i enter this formula

=UNIQUE(A2:A8)

My objective is to get the monthwise total for each product. So, in cell B11, I enter this formula

=BYCOL($B$2:$M$8,LAMBDA(c,SUMIF($A$2:$A$8,A11,c)))

As expected, this spills column wise perfectly. However, I'd like it to spill row wise as well.

What modification would i need in cell B11 to make the formula spill row wise and column wise?

Thank you.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi Ashish, you can try the following :

Book2
ABCDEFGHIJKLM
1ProductSepOctNovDecJanFebMarAprMayJunJulAug
2A123456789101112
3B2345678910111213
4C34567891011121314
5A456789101112131415
6B5678910111213141516
7D67891011121314151617
8A789101112131415161718
9
10A121518212427303336394245
11B7911131517192123252729
12C34567891011121314
13D67891011121314151617
Sheet1
Cell Formulas
RangeFormula
A10:M13A10=LET(a,UNIQUE(A2:A8),HSTACK(a,MMULT(--(TRANSPOSE(A2:A8)=a),B2:M8)))
Dynamic array formulas.
 
Upvote 0
Solution
Another option
Excel Formula:
=DROP(REDUCE("",A11#,LAMBDA(a,b,VSTACK(a,BYCOL($B$2:$M$8,LAMBDA(bc,SUMIF($A$2:$A$8,b,bc)))))),1)
 
Upvote 0
Hi Ashish, you can try the following :

Book2
ABCDEFGHIJKLM
1ProductSepOctNovDecJanFebMarAprMayJunJulAug
2A123456789101112
3B2345678910111213
4C34567891011121314
5A456789101112131415
6B5678910111213141516
7D67891011121314151617
8A789101112131415161718
9
10A121518212427303336394245
11B7911131517192123252729
12C34567891011121314
13D67891011121314151617
Sheet1
Cell Formulas
RangeFormula
A10:M13A10=LET(a,UNIQUE(A2:A8),HSTACK(a,MMULT(--(TRANSPOSE(A2:A8)=a),B2:M8)))
Dynamic array formulas.
Thank you for helping Sanjeev. That works well.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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