I want to to calculate with entire ranges (to which I assigned a name beforehand) just like I would with individual cells. An example:
Result-range = range1 - range2
the ranges have the same dimension and the upperleft cell from range2 should be subtracted from the upperleft cell from range1 and its resulting value written into the upperleft cell in the result-range and so on.
Not a big thing I reckon but still couldn't find a solution
I am not totally sure there is not a built in function to do this either! (somebody will know) but that takes the fun out of it!
Normally you would just enter the formulas in the cells to do the calculations, but I assume there is more being done to the sheet than this.
Of course it can be written as a function, but I am not sure why you would want to, unless you make it a Boolean function with error handling in case it falls over, ie incapable ranges/no range defined etc. Otherwise you could you can call it as a sub anyway (and pass the ranges or range names as augments in required).
well i guess i was more thinking loudly... in PERL e.g., you can use the the return function to specifiy the variable to be passed back by the subroutine, so in that case the result range (or rather its values).
i couldn't get your sub call run. i removed one space (range_2) and the "range" in "result range name" and it still didn't work...
as the the result-range is defined in the main script (and passed to the sub as a parameter), i guess i don't have to call the sub anything like that:
will automatically put the the calculated results in the "Result Name" range as values.
You could put a formula to add (subtract) the two elements in the results range by using the address property of the cells, similar to the INDIECT code in our other thread, if you prefer, but I digress.