SUM + INDIRECT formula of a cell range

Adamck

New Member
Joined
Jun 22, 2012
Messages
2
Hi Guys.
Im generating an Excel workbook with 2 sheets inside it from PHP, therefor im a little limited on what can / cant be achieved.
I want to add a formula that sums 2 cell ranges from the other worksheet.

Example
Code:
=SUM(Synthesis!E36:E38)+SUM(Synthesis!E49:E51)

This works in Excel, but gives an #N/A error when i create the sheet from PHP.
I think its due to the formula referencing the other sheet and it doesnt exist yet (php hasnt created it yet) <--- this is a guess...

So speaking to a few people regarding the issue, they have told me to use INDIRECT

Example
Code:
=INDIRECT("Synthesis!E36")+INDIRECT("Synthesis!E38")

Which works great for adding 2 single cells together, but i need to add 2 cell ranges together

Example
Code:
=SUM(INDIRECT("Synthesis!"&"E36:E38"))+SUM(INDIRECT("Synthesis!"&"E39:E43"))

But my attempt above doesnt work and gives me a #VALUE error saying the formula is of the wrong data type (although it does work in EXCEL when i try it AFTER its been generated)

Does anyone have any ideas of how i can multiply 2 cell ranges together from another sheet using INDIRECT?

May i remind you this is being written and generated in PHP, so Macros and some other functions are not possible.

Please help!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I tried this
Rich (BB code):
=SUM(INDIRECT("Synthesis!E36"):INDIRECT("Synthesis!E38")+SUM(INDIRECT("Synthesis!E49"):INDIRECT("Synthesis!E51")


And it seemed to delete everything from the first : onwards
Leaving me with
Rich (BB code):
=SUM(INDIRECT("Synthesis!E36")


:(

This works perfectly but is a little long, i was hoping to be able to reference a range rather than each cell individually

Rich (BB code):
=INDIRECT("Synthesis!E36")+INDIRECT("Synthesis!E37")+INDIRECT("Synthesis!E38")+INDIRECT("Synthesis!E49")+INDIRECT("Synthesis!E50")+INDIRECT("Synthesis!E51")

Any way of shortening this?
 
Upvote 0
Hi

Try this :-
Code:
=SUM(INDIRECT("Synthesis!E36:E38"))+SUM(INDIRECT("Synthesis!E39:E43"))
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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