I'm trying to do the following in the formula bar:
={A1+A2,A2-A1,A3+A4}, but it doesn't let me. Seems I only use constants?
I'm trying to do the following in the formula bar:
={A1+A2,A2-A1,A3+A4}, but it doesn't let me. Seems I only use constants?
what are you trying to do? cant you just
=SUM(A1+A2,A2-A1,A3+A4) or are you trying to create an array say {3,1,7} for use in another function?
Last edited by martindwilson; 06-28-2010 at 03:10 AM.
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and now happily retired
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Trying to create the array {A1+A2, A2-A1, A3+A4}
Last edited by shg; 06-28-2010 at 11:43 AM.
yes but for what use?
well mainly for feasibility and so I don't have to setup multiple worksheets just to set up the arrays. Right now I have a seperate sheet that is used more or less exclusively to set up data for me to use in arrays,if I had the ability to just create arrays on the fly ie. {A1+A2,A3-A4,A5+A2}, etc. as opposed to doing Sheet2!A1:A3 where Sheet2!A1 = A1+A2, Sheet2!A2 = A3-A4, Sheet2!A3 = A5+A2
hmmmmmm that has me stumped.
possibly via vba
ok anyone else got an offer?
BUMP
anyone? there has to be a neat way of doing this
=Agg(A1+A2, A2-A1, A3+A4)![]()
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
Note: If you wish to see the individual values of Shg's function, then it can be entered as an array, select the number of cells = to the number of arrays you are calculating. Enter with CNTRL SHFT ENTER
Hope that helps.
Last edited by ChemistB; 07-02-2010 at 12:38 PM. Reason: Modified after DO's explaination
ChemistB
My 2?
substitute commas with semi-colons if your region settings requires
Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)
Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble
I think shg's post is more to illustrate how all three results are returned in a single 1D Array (you see only the first value in the cell however all three exist - eg SUM(Agg(...)) would return the aggregate of the Array).
The same can be achieved using formulae but it is significantly less flexible:
=INDEX(CHOOSE({1,2,3},A1+A2,A2-A1,A3+A4),0)
(same point holds - ie you see one value but all exist within [highlight and press F9 or again see: SUM(INDEX(...)) which would aggregate the 1d array])
The native approach is less flexible given the {1,n} would need to be adjusted based on the number of arguments supplied in the CHOOSE whereas shg's UDF utilises a ParamArray and thus will adjust dynamically
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Donkey
unfortunately your method does not actually return an array, it returns a number within an array (sort of like a read command like array[5]). I'm looking for something actually returns an array, ie. similar to row(), column(), etc.
Unforunately the mac2008 version of excel i'm using does not support VBA =(
What I'm ultimately trying to do is:
I have a large n x m matrix of percentages, from E8 to I12
I need to create an array {(1-E8)*(1-F8)*...*(1-CURRENTCOLUMN8) , (1-E9)*(1-F9)*...*(1-CURRENTCOLUMN9) , ... , (1-E12)*(1-F12)*...*(1-CURRENTCOLUMN12)}
and multiply this huge array by another array
Last edited by themachine; 07-05-2010 at 11:09 AM.
Please read my post again, specifically:Originally Posted by themachine
If you're ever unsure as to what is being returned be sure to make use of the F9 feature in the Formula Bar - ie highlight the INDEX function and press F9 - you will see the array of results.Originally Posted by D.O
A cell will only ever display a single result - whereas in fact the INDEX holds all values by virtue of the 0 row_index - do not confuse cell content with formula "output".
That would be a good thing to have in your profile, rather than Excel 2007.Unforunately the mac2008 version of excel i'm using ...
If you select D1:D3 and array-enter the formula, you'll see all three values returned.
I'm pretty sure array multiply doesn't do it:
http://i.imgur.com/tCGgt.png
A5:A7 were array formula entered, but they should be:
177
440
305
Where as they are:
177=(A1+A2)*3
236=(A1+A2)*4
295=(A1+A2)*5
SUM() does seem to iterate over the index and work as intended, but Array multiply certainly doesn't
Last edited by themachine; 07-05-2010 at 11:57 AM.
That formula generates 9 results. Maybe what you're looking for is
=C1:C3*CHOOSE({1;2;3}, A1+A2, A1+A1, A3+A1)
Note the semicolons in lieu of the commas to make the second array a column array.
Ahh, I see what you mean. It was creating a 3x3 matrix
{1;2;3} is a column array where as {1,2,3} is a row array?
Last edited by themachine; 07-05-2010 at 12:13 PM.
The latter is a row array; neither is more 'normal' than the other.
Many thanks for the help,
Using this technique, I'm trying to make the array
{PRODUCT(E8:F8),PRODUCT(E9:F9),...,PRODUCT(E99:F99)}
No need for any of that; =E8:E99*F8:F99, array-entered.
Sorry I wasn't specific enough, unfortunately I need to be able to drag/expand at will
Column 1:
{PRODUCT($E8:F8),PRODUCT($E9:F9),...,PRODUCT($E99:F99)}
allows me to drag it to the next column to create
Column 2:
{PRODUCT($E8:G8),PRODUCT($E9:G9),...,PRODUCT($E99:G99)}
I'm really trying to create this
http://i.imgur.com/5HXgw.jpg
Essentially a weighted average of risk reductions scalable across multiple components and reducable by percentages. My implementation is kinda disgusting, as I have 2 other sheets used mainly to just store data for taking (1-percentages), and another for multiplying the reduction up to the respective dates
Last edited by themachine; 07-05-2010 at 03:19 PM.
Please post workbook, not pictures.
Yoy can drag the formula =$E8:$E99*F8:F99, to the right to get those results, but why bother with an array formula at all for that?
The problem is that you're still multiplying by only two arrays independent of position, where as the product one multiplies a variable number of arrays dependent on the position
I have uploaded the workbook,
What I'd really like is to remove the products/complement sheets so the main sheet isn't dependent on the other two. It's a very ugly implementation
Last edited by themachine; 07-05-2010 at 04:07 PM.
Rather than using two sheets of helper cells, you could just use a few columns. Changes highlighted, see also defined names.
DaddyLongLegs might be able to suggest a way to get rid of the helper columns.
Last edited by shg; 07-05-2010 at 06:18 PM.
I can't see any simple way to do that (or really even a complicated way) - I think in this situation you already have the best approach, shg. Even if you could get rid of the helper cells it would be considerably more complex to do so.....
Audere est facere
Many thanks for the help.
Last edited by themachine; 07-06-2010 at 09:03 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks