How to use ARRAYFORMULA to work with an array of array - google-sheets

I'm currently working on a formula but I can't seem to make it work the way I intend to.
The column A of the spreadsheet look like something like that:
| A |
| B |
| C |
| D |
| E |
And what I am trying to do is get an output like that:
| A |
| A | B |
| A | B | C |
| A | B | C | D |
| A | B | C | D | E |
So I tried using offset, to get from the first line to the current line for each of my lines.
=ARRAYFORMULA(TRANSPOSE(OFFSET(A1;0;0;ROW(A1:A5)))
But since ROW(A1:A5) doesn't return an array the cell was just | A |
So I tried adding ARRAYFORMULA around the ROW(A1:A5) and what I go was:
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
Which is what I need! But if I add it to the original function, I still only get | A |
Is there a way for me to "force" ARRAYFORMULA to run on A1:A5 so that I get the required output?
Additionnal data
I know this would be easier to do with a script but a script solution is not what I'm looking for. I'm trying to understand why it does that and how to prevent it.
This formula is meant to be used inside another so I need it to be only 1 formula, I can't use the cross to expand it.
I don't mind if the solution isn't showable (if the array superpose itself by example).
I made a demo here.
I also tried with INDIRECT instead of OFFSET to get the ranges and I had the same results.

Please try, somewhere in the Row1, assuming that is where your first A is, and copied down to suit:
=SPLIT(JOIN("|",A$1:A1),"|")
(as an array formula, if you must.)

=ARRAYFORMULA(IF(ROW(A2:A6)>=TRANSPOSE(ROW(A2:A6));TRANSPOSE(A2:A6);))
ROW() is used to create series of vertical numbers,which are compared against the same series of numbers horizontally to create a 5x5 matrix of TRUE/FALSE,which can then easily be extrapolated to the desired output.

Assuming your data is located at A1:A8 enter this formula at C1 then copy it to C2:C8:
= TRANSPOSE ( ARRAY_CONSTRAIN( $A$1:$A$8 ,
1 + ROW() - ROW( $C$1 ) , 1 + COLUMN() - COLUMN( $C$1 ) ))

Related

DGET with array constant as criteria parameter with a blank element

If I have the following table:
\ || A | B | C | D | E | F |
_______________________________________
1 || H1 | H2 | H3 | H4 | 10 | 20 |
2 || 10 | AA | .2 | 70 | 70 | 100 |
3 || 10 | BB | .3 | 80 | | |
4 || 20 | CC | .4 | 90 | | 10 |
5 || 20 | DD | .5 | 100 | | CC |
6 || | | | | | |
(*All workings examples are in Google Docs)
This works:
=DGET(A1:D5,"H3",{A1:D1;E1,E3,E4,E2})
RESULT = 0.2
But I'm looking for a way to have a blank element in the constant array I'm using as the criteria without referencing a blank cell. I need the blank elements as otherwise DGET treats them as criteria to be evaluated.
Something like this:
=DGET(A1:D5,"H4",{A1:D1;E1,#BLANK,#BLANK,E2})
Where #BLANK is whatever magic makes google docs treat the element as empty.
I know that I can do:
=DGET(A1:D5,"H3",{A1,D1;E1,E2})
And just limit the number of columns in the criteria, but I'd like to specify the entire header set in the constant and just choose the columns I want specified.
For instance if I wanted something like this:
=DGET(A1:D5,"H3",{A1:D1;F1,F3,F3,F2;F4,F5,F3,F3})
RESULT = 0.5
But as this:
=DGET(A1:D5,"H3",{A1:D1;F1,#BLANK,#BLANK,F2;F4,F5,#BLANK,#BLANK})
In addition to the primary question of how to set an empty element, I'm curious if there is a way to perform a similar lookup in Excel. LOOKUP functions do not appear to support filtering on multiple criteria and the Database functions don't support arrays for defining criteria (only a cell range).
I believe that the #BLANK you're looking for is:
""
And, No. Excel does not support such sophisticated arrays.

Get a row from a range based on a single value in column

I'm using a spreadsheet to store highscores. I have one column (Initials [Column D]) and one column (Scores [Column E]). They are already sorted from highest to lowest (dependent upon the Scores). I want to get the first occurrence of all initials and that initials score.
For example if I had this:
|Initials|Scores|
| ABC | 5 |
| NOT | 4 |
| ABC | 2 |
| LOL | 1 |
I want to get this:
|Initials|Scores|
| ABC | 5 |
| NOT | 4 |
| LOL | 1 |
I've been able to get just the names portion with =UNIQUE(D:D), but how would one also get the scores from the next column? I've been trying for a while now, and can't figure it out.
Since the values in E are already sorted, try:
=ArrayFormula(vlookup(unique(filter(D2:D, len(D2:D))), D2:E, {1,2}, 0))
of if you want to use a limited range:
=ArrayFormula(vlookup(unique(D2:D50), D2:E50, {1,2}, 0))
See if that works ?

Comparing Values on the Same Row

Sorry if this has been answered but hours of Google-ing has revealed no elegant solution.
I have a sheet that looks like this only there are hundreds of rows.
+---+---+---+---+-----+
| A | B | C | D | E |
+---+---+---+---+-----+
| X | a | Y | b | 1.2 |
| X | b | Y | c | 1.5 |
| Y | c | Z | c | 1.8 |
+---+---+---+---+-----+
My goal is to count rows where for example the character in column A="X", character in column C="X" and characters in columns B and D are not the same (B!=D). The first part is working...
COUNTIFS(A:A ,"X" , C:C, "X")
but I can't figure out how to compare two cells that are both part of a range but on the same line. The following seems to compare the whole ranges...
COUNTIFS(A:A ,"X" , C:C, "X", B:B, D:D)
Additionally, I'd like to sum the values in column E for similarly defined groups.
Thanks in advance!
Solved it! Added the following formula to each row in column F...
=(B:B=D:D)+0
That will return 1 or 0 depending on whether the contents of B and D is matching. And that is something I can add to my existing formula.
UNTIFS(A:A ,"X" , C:C, "X", F:F, 0)

Trying to find a Google Spreadsheet formula or query for this example

A | B | C | D | E | F | G
name|num|quant|item|quant2
car | 5 | 100 |
| | |wheel| 4
| | |axel | 2
| | |engine|1
truck| 2 | 20 |
| | |wheel| 6
| | |bed | 1
| | | axel| 2
I need a formula which will do B*C*E. the tables look like this, so it needs to be something like
=b$2*c$2*e3 and then dragged.... and then the next set, b$6*c$6*e7 and dragged, etc but i want sure how to get the cieling sort of something. if b5 is empty, look at each above until it finds the one not filled.
I am trying to use this to get total quantity of parts per car, truck etc.... and then group by part.
I dont have a set of DB tables to do this, just a spreadsheet.
I had to add some additional information to resolve this.
I was thinking there would be a way to do a google script that would do this and update the file, but i couldnt seem to find it.
I first summed each group item:
=b$3*e4
and dragged for that grouping.
Then afterwards, i went to a selection of space and wrote up a query.
=query(D:F, "select D,sum(F) group by D")

How to map values within a data series to different y-axes?

I have a column chart in Highcharts that looks roughly like this:
| |
| |
S | |
e | | M
c | +-+ | e
o | +-+ | | +-+ +-+ +-+ | t
n | +-+ | | | | | | | | +-+ | | | e
d | | | | | | | | | +-+ | | | | | | | r
s | | | +-+ | | | | | | | | | | | | | | | s
| |1| |2| |3| |1| |2| |3| |1| |2| |3| |
+-------------------------------------------------------------+
Fld A (s) Fld B (s) Fld C (m)
The labels "1", "2", and "3" refer to records; while "A", "B", and "C" refer to fields. So record #1 is represented as three separate values over fields A, B, and C, as represented by the labeled columns. I achieved this result by:
Providing an array to the series config option, one series for each record.
Providing an array to the xAxis/categories config option, one element for each field name.
Providing a 2-element array to the yAxis config option.
My problem is that values in field C will are shown on the Seconds axis, even though they are in units of Meters. I could change the entire series to be on the Meters axis (via the series/yAxis config option), but then fields A and B would show on the wrong axis.
Is there any way to map values within a series to different axes?
EDIT 9/12/2011: If this is impossible as stated, I'm willing to accept an alternate method, such as a different configuration or modifying Highcharts internals, via a plugin or otherwise.
EDIT 9/13/2011: I asked the same question on the HighCharts forum here: http://highslide.com/forum/viewtopic.php?f=9&t=12315, and no one has answered it there either. I'm beginning to think there is probably not any easy answer. :)
A demo is available here: http://www.highcharts.com/demo/combo-dual-axes
chart.yAxis should be an array of two yAxis objects and your series object should specify the yAxis that it corresponds to.
A highslide support person told me this is not possible.
However, another person gave me a possible workaround: create a separate set of series for field C. Then set the values for fields A and B in the second set to null, and set the values in the first set of series for field C to null.
There is a link to a jsfiddle that demonstrates this workaround in the forum topic: http://highslide.com/forum/viewtopic.php?f=9&t=12315

Resources