SUM function not functioning

akaron

New Member
Joined
Aug 8, 2012
Messages
18
Hi, I am able to assemble a cell range (O21:O162) using this formula:
=CONCATENATE("O21:O",ROW(XLOOKUP(INDEX(B21:B670,MATCH(TRUE,B21:B670<0,0)),B21:B670,A21:A670)))

But when I insert it into a sum function, I get a #VALUE! error. Can someone show me what I'm doing wrong?
=SUM(CONCATENATE("O21:O",ROW(XLOOKUP(INDEX(B21:B670,MATCH(TRUE,B21:B670<0,0)),B21:B670,A21:A670))))

I just wanted to find the sum of all values in the range I put together (O21:O162).
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi,

Try using INDIRECT
Excel Formula:
=SUM(INDIRECT("O21:O162")

Rgds
Rob
 
Upvote 0
When I use:
=SUM(INDIRECT(CONCATENATE("O21:O",ROW(XLOOKUP(INDEX(B21:B670,MATCH(TRUE,B21:B670<0,0)),B21:B670,A21:A670)))))
it comes up with ($276.13)

If I use:
=SUM(O21:O162)
I get $247.54

I know that this function is giving me O21:O162, because I have it in another cell to check
=CONCATENATE("O21:O",ROW(XLOOKUP(INDEX(B21:B670,MATCH(TRUE,B21:B670<0,0)),B21:B670,A21:A670)))

Why would they be different sums just with the addition of INDIRECT?
 
Upvote 0
How about
Excel Formula:
=SUM(O21:INDEX(O:O,ROW(XLOOKUP(INDEX(B21:B670,MATCH(TRUE,B21:B670<0,0)),B21:B670,A21:A670))))
 
Upvote 0
Solution
Hi

Try this:
Excel Formula:
=SUM(O21:INDEX(O:O,XMATCH(-9^99,B21:B45,1)+20))
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,098
Members
453,021
Latest member
Justyna P

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