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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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
How about
Excel Formula:
=SUM(O21:INDEX(O:O,ROW(XLOOKUP(INDEX(B21:B670,MATCH(TRUE,B21:B670<0,0)),B21:B670,A21:A670))))
This is the same incorrect sum (???)

I lied! this generates the correct sum, thank you!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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