Xlookup to SUM first and last values in a list with multiple entries

Zakky

Board Regular
Joined
Mar 26, 2016
Messages
145
Office Version
  1. 365
Platform
  1. Windows
Hi, I am trying to sum the first and last values in a list where there are multiple entries of the same product. The formula works well for >1 entry, but it fails on a single entry. For some strange reason, it doubles the value of the single entry. Not quite sure how to fix it using XLookup. Your help would be greatly appreciated. Thank you.
XLookup.PNG
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Book1
ABCDEF
1
2ProductSalesProduct Sales
3Apples1Apples8
4Onions2Onions2
5Carrots3Carrots11
6Apples4Grapes5
7Grapes5Oranges7
8Oranges6Bananas12
9Apples7
10Carrots8
11Oranges9
12Bananas10
13Bananas11
14Bananas2
15Oranges1
16
Sheet1
Cell Formulas
RangeFormula
D3:D8D3=UNIQUE(A3:A15)
E3:E8E3=BYROW(D3#,LAMBDA(r,LET(f,FILTER(B3:B15,r=A3:A15),IF(ROWS(f)=1,f,TAKE(f,1)+TAKE(f,-1)))))
Dynamic array formulas.
 
Last edited:
Upvote 0
Cubist, Thank you for the prompt reply. WOW! There was a lot more work to do than i thought. As always, your solution works like a dream. Once again, thank you for helping. Have a great day!
 
Upvote 0

Forum statistics

Threads
1,215,209
Messages
6,123,646
Members
449,111
Latest member
ghennedy

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