Google Sheets - Logical AND between ranges [duplicate] - google-sheets

This question already has answers here:
ArrayFormula and "AND" Formula in Google Sheets
(4 answers)
Closed 4 months ago.
How can I perform a logical AND between two ranges?
I've tried using the AND function, but it collapses the array into a single TRUE/FALSE value by performing an AND between all the cells, instead of operating pairwise between the ranges.
Example:
ARRAYFORMULA(AND(A1:B2, C1:D2))
where A1:B2 is
| | A | B |
|-|-----|-----|
|1|TRUE |FALSE|
|2|FALSE|TRUE |
and C1:D2 is
| | C | D |
|-|----|-----|
|1|TRUE|FALSE|
|2|TRUE|FALSE|
would result in
| | X | Y |
|-|-----|-----|
|1|TRUE |FALSE|
|2|FALSE|FALSE|
But instead what happens is
| | X | Y |
|-|-----|-----|
|1|FALSE| |
|2| | |

multiplication is the way:
=ARRAYFORMULA(A1:B2*C1:D2)
=INDEX(A1:B2*C1:D2=1)

Related

LOOKUP always selects the last number in the column

I Have a list of 40 numbers similar to below
+-----------+------------+
| J | T |
+-----------+------------+
| 1 | 123.4 |
+-----------+------------+
| 2 | 223.8 |
+-----------+------------+
| 3 | 23.4 |
+-----------+------------+
| 4 | 443.9 |
+-----------+------------+
| 5 | 143.5 |
+-----------+------------+
So I want to look up a number in the first column based on the second.
So I am using the following formula (actual sheet has 40 numbers) =LOOKUP(23.4,$T$43:$T$82,$J$43:$J$82) in this example I would have expected the result to 3 but it is always 5 (40 in the actual sheet).
Where am I going wrong?
let use VLOOKUP() instead
=VLOOKUP(23.4,{$T$43:$T$82,$J$43:$J$82},2,FALSE)
because LOOKUP() doesn't have the option or the argument for exact match
I hope it'll work for you
Or use Index/match:
=index($J$43:$J$82,match(23.4,$T$43:$T$82,0))

Partial transpose of Sheet

I have a Google Sheet with this format:
+---------+---------+---------+------------+------------+------------+------------+--------+--------+
| Field_A | Field_B | Field_C | 24/09/2019 | 25/09/2019 | 26/09/2019 | 27/09/2019 | day... | day... |
+---------+---------+---------+------------+------------+------------+------------+--------+--------+
| ValX | ValY | ValZ | Val1 | Val2 | Val3 | Val4 | | |
| ValW | ValY | ValZ | Val5 | Val6 | Val7 | Val8 | | |
+---------+---------+---------+------------+------------+------------+------------+--------+--------+
First 3 columns are specific fields and all other columns are related to one specific day in a given (and static) range.
I need to convert the table in the following format:
+---------+---------+---------+------------+-----------+
| Field_A | Field_B | Field_C | Date | DateValue |
+---------+---------+---------+------------+-----------+
| ValX | Valy | Valz | 24/09/2019 | Val1 |
| ValX | Valy | Valz | 25/09/2019 | Val2 |
| ValX | Valy | Valz | 26/09/2019 | Val3 |
| ... | | | | |
+---------+---------+---------+------------+-----------+
Basically, the first 3 columns are gathered as-is, but the day-column in transposed (is even the correct term?) with 2 values:
The date
The value in the cell related to date
Is something that can be achieved with formula or do I need to create a bounded AppsScript?
Following a sample Sheet demo: https://docs.google.com/spreadsheets/d/1cprzD96i-4NQ8tieA_nwd8s43yKF-M8Kww4yWNfB6tg/edit#gid=505040170
In Sheet Start you can see the initial data and format, 3 static columns and one column for every da
In Sheet End you can see the output format I'm looking for, the same 3 static columns, but the date and cell value related to date are transposed as a row.
You can see the Formula I used, TRANSPOSE for every row, where I select the days for the IV column and one row at a time for the V row.
For the 3 static columns, I replicated the Formula for every instance of the day related to that row.
This is working but requires much manual work to set up every single TRANSPOSE. I'm wondering if there is a more automatic way of doing this (except for using AppsScript, in that case, I'm already planning on doing this if not other solutions are available)
=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(Start!D2:F<>""; "♦"&TRANSPOSE(QUERY(TRANSPOSE(Start!A2:C&"♠");;999^99))&
TEXT(Start!D1:F1; "dd/mm/yyyy")&"♠"&Start!D2:F; ));;999^99));;999^99); "♦")); "♠")))

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.

How do I count merged cells separately in Google Spreadsheets?

I'm using countif(a1:a10, "*") to sum the number of names in a guest list. However, some cells have been merged, e.g. for married couples or families where only one name is supplied.
See below for a concrete example, where (+ x) are merged with the cell above:
| A | B |
1 | Cheah | Teo |
2 | Hadi's Family | Robinson |
3 | (+ wife) | Müller |
4 | (+ son) | Chan |
5 | Ganesan | Yeong |
6 | Chng | (+ wife) |
7 | Tan | Ng |
8 | Williams | (+ husband) |
9 | Brecht | (+ daughter) |
10 | Ahmad | |
In the example above, I would like to obtain 10 in column A and 9 in column B.
I've seen #MaxMakhrov's suggestion of last non-empty row, but haven't been able to get a working solution out of it yet.
Any ideas?
The formula of finding last non-empty row may help:
=MAX(FILTER(ROW(A:A),A:A<>""))
But it will give the wrong result if last cells are merged:
Example:
1 a
2
3 b > merged
4
Last non-emty row is 2 in example above because cells 2,3,4 are merged.

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