Sum of last 'n' values from two different columns

chrisb182

New Member
Joined
Mar 3, 2022
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone,

From the below information, I would like to sum the last 'n' values based from the TE columns (K and R) depending on which team I select in another cell.

For example:
I select the team "NO" and want to sum up the last two values --- the formula would sum up 25.46 from Column R and 19.7 from Column K.

Does anyone know how to do this?

I really hope I'm making my request clear.

Cheers,

Chris

1669133722370.png
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Do you reckon it's because of the Excel version that I have? View attachment 79372
Ahhhhh ---- I think I found out why.

There are blank cells between Row166 - Row274 (as there are still results to be inputted).

When I replace 274 with 166, the formula works.

I'm guessing there is no way to make the formula exclude blank cells?
 
Upvote 0
How about
Excel Formula:
=LET(h,FILTER($C$3:$I$1000,($E$3:$E$1000=X3)*($I$3:$I$1000<>"")),a,FILTER($C$3:$P$1000,($G$3:$G$1000=X3)*($P$3:$P$1000<>"")),r,ROWS(h),s,SEQUENCE(r+ROWS(a)),SUM(INDEX(SORT(IF(s<=r,INDEX(h,s,{1,7}),INDEX(a,s-r,{1,14})),1,-1),{1;2;3},2)))
 
Upvote 0
That is spot on bud!

Thank you SOOOOO much. I don't understand how quickly you come up with these solutions. Hahaha.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,342
Members
448,956
Latest member
Adamsxl

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