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

Zakky

Board Regular
Joined
Mar 26, 2016
Messages
148
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

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