Check if value of Cell is in another Sheet2.CellRange if yes, take the value of Sheet2.CellD position - openoffice-calc

OBS: im using OpenOffice, i cant use the "OpenOffice" tag, =|
i have this Sheet2:
and I'm planning to type the value of B4:B12 inside another Sheet
for example, i type in A1 the value 4, so it will fill the B with D4 and C with E4(from sourceSheet position)
Sheet1 that will get the value of D or E from Row where Sheet2.B is equal Sheet1.A
--A--B--C
1|4-D4--E4
2|
3|7-D7--E7
4|1-D1--E1
and i tried this:
LOOKUP(A1;Sheet2.B1:Sheet2.B12;Sheet2.D4:Sheet2.D12);
but its not getting the value, just return sometimes #NAME

I believe your ranges are written incorrectly.
First, Sheet2.B1:Sheet2.B12 should be Sheet2.B1:B12
Second, for the Lookup function, the searchtable and result table must be the same size (take a look at the online documentation for details).
Try this instead:
LOOKUP(A1;Sheet2.B1:B12;Sheet2.D1:D12);

Please try in B1 and copied across to C1, then both down to suit:
=IF(ISERROR(LOOKUP($A1;Sheet2.$B$4:$B$12;Sheet2.D$4:D$12));"";LOOKUP($A1;Sheet2.$B$4:$B$12;Sheet2.D$4:D$12))

Related

Google sheets IF stops working correctly when wrapped in ARRAYFORMULA

I want this formula to calculate a date based on input from two other dates. I first wrote it for a single cell and it gives the expected results but when I try to use ARRAYFORMULA it returns the wrong results.
I first use two if statements specifycing what should happen if either one of the inputs is missing. Then the final if statement calculates the date if both are present based on two conditions. This seems to work perfectly if I write the formula for one cell and drag it down.
=IF( (LEN(G19)=0);(U19+456);(IF((LEN(U19)=0) ;(G19);(IF((AND((G19<(U19+456));(G19>(U19+273)) ));(G19);(U19+456))))))
However, when I want to use arrayformula to apply it to the entire column, it always returns the value_if_false if neither cell is empty, regardless of whether the conditions in the if statement are actually met or not. I am specifically talking about the last part of the formula that calculates the date if both input values are present, it always returns the result of U19:U+456 even when the result should be G19:G. Here is how I tried to write the ARRAYFORMULA:
={"Date deadline";ARRAYFORMULA(IF((LEN(G19:G400)=0);(U19:U400+456);(IF((LEN(U19:U400)=0);
(G19:G400);(IF((AND((G19:G400<(U19:U400+456));(G19:G400>(U19:U400+273)) ));(G19:G400);(U19:U400+456)))))))}
I am a complete beginner who only learned to write formulas two weeks ago, so any help or tips would be greatly appreciated!
AND and OR are not compatible with ARRAYFORMULA
Replace them by * or +
Try
={"Date deadline";ARRAYFORMULA(
IF((LEN(G19:G400)=0),(U19:U400+456),
(IF((LEN(U19:U400)=0), (G19:G400),
(IF((((G19:G400<(U19:U400+456))*(G19:G400>(U19:U400+273)) )),(G19:G400),
(U19:U400+456)))
))
)
)}
Keep in mind you cannot use AND, OR operators in an arrayformula, so you must find an alternative method such as multiplying the values together and checking them for 0 or 1 (true*true=1)
I am gathering based on your formula's and work that you want to have the following:
If G19 is blank show U19 + 456
If U19 is blank show G19
If G19 is less than U19 + 456 but greater than U19 + 273 show G19
Otherwise show U19 + 456
I'm not too sure what you want to happen when both columns G and U are empty. Based on your current formula you are returning an empty cell + 456... but with this formula it returns an empty cell rather than Column U + 456
Formula
={"Date deadline";ARRAYFORMULA(TO_DATE(ARRAYFORMULA(IFS((($G19:$G400="")*($U19:$U400=""))>0,"",$G19:$G400="",$U19:$U400+456,$U19:$U400="",$G19:$G400,(($G19:$G400<$U19:$U400+456)*($G19:$G400>$U19:$U400+273))>0,$G19:$G400,TRUE,$U19:$U400+456))))}

Googlesheet IF with multiple cases

in my Google sheet table I have the first list with summary of invoices which are then separated to 4 lists according to parameters (manually). I need to know about all invoices from the first list, on which category/list they are.
So for example - lists: Alphabet, abc, def, mno, xyz. In Alphabet is column "list".
How to write function which found invoice on another list according to ID (column B) from Alphabet and write name of the correct list to column "list". I tried to write this function using IF, match, etc. But I still don't have solution. Can you help me please? Sorry for my English :-)
So here is an example which you could adapt. In columns E:H on the first sheet (and I could hide these columns later, starting in row2 and dragging down as needed, I put the following formulas:
=IF(LEN(iferror(query(abc!$A$2:$A,"select A where A='" & $A2 &"'"),""))>0,"abc","")
=IF(LEN(iferror(query(def!$A$2:$A,"select A where A='" & $A2 &"'"),""))>0,"def","")
=IF(LEN(iferror(query(mno!$A$2:$A,"select A where A='" & $A2 &"'"),""))>0,"mno","")
=IF(LEN(iferror(query(xyz!$A$2:$A,"select A where A='" & $A2 &"'"),""))>0,"xyz","")
Probably I could have simplified a little by putting the sheet names in E1:H1, but you get the idea.
Each of these looks for the ID. If the query succeeds, it returns the name of the sheet. If it fails, it returns the empty string.
Now in column B where I actually want the results, I put this formula in B2 and drag to copy as needed.
=if(E2&F2&G2&H2="","nowhere",E2&F2&G2&H2)
It says put those strings together, and if there is nothing there say nowhere, otherwise say the list. If it appears on more than one, and that can really happen, you could use JOIN instead.

Arrayformula to lookup last entry

I have this example here
I need to have the data in column D filled in with arrayformula. The value should be the value in column B.
I've tried using combination of ROW&INDIRECT&FILTER&QUERY|VLOOKUP , but it didn't work, as if ROW() cannot be used in arrayformula. Maybe you guys have some idea that could work.
use:
=ARRAYFORMULA(IF(C7:C="",, VLOOKUP(ROW(A7:A), IF(B7:B<>"", {ROW(A7:A), B7:B}), 2, 1)))

How to populate a value when comparing two columns, VLOOKUP or IF?

I'm trying to create "Sale Rep" summaries by "Shop", where I can simply filter a column by the rep's name, them populate a total sales for each shop next to the relevant filter result.
I'm using this to filter all the Stores by Scott:
=(filter(D25:D47,A25:A47 = "Scott"))
Next, want to associate the Store/Account in F to populate with the corresponding value of E inside of G. So, G25 should populate the value of E25 ($724), G26 with E26 ($822), and F27 with E38 ($511.50)
I don't know how to write the formula correctly, but something like this is what I'm trying to do: =IF(F25=D25:D38),E25 I know that's not right, and it won't work in a fill down. But I'm basically trying to look for and copy over the correct value match of D and E inside of G. So, Misty Mountain Medicince in F27 will be matched to the value of E38 and populated in G27.
The filter is what's throwing me off, because it's not a simple fill down. And I don't know how to match filtered results from one column to a matched value in another.
Hope the screenshot helps. Screenshot of table:
Change Field Rep: Scott to Scott and you might apply:
=query(A25:E38,"select D,E where A='"&F24&"'")
// Enter the following into G25 and copy down column G
=(filter(E25:E47, D25:D47 = F25))
or
// Enter the following into G25 will expand with content in F upto row 47
=ArrayFormula(IF(F25:F47 <> 0, VLOOKUP(F25:F47, D25:E47, 2, FALSE),))

Google Sheets; H = C OR if empty D OR if empty E OR "empty"

=if((len(C2:C);C2:C;"")(len(D2:D);D2:D;"")(len(E2:E);E2:E;"")*(len(F2:F);F2:F;"");"")
I was going for this one, but it didn't get me far. Whats wrong; any ideas?
Please try:
=ArrayFormula(if(len(C2:C),C2:C,if(len(D2:D),D2:D,if(len(E2:E),E2:E,if(len(F2:F),F2:F,"")))))
Looks, row by row, first at the ColumnC cell – if populated returns that value, otherwise passes on to the ColumnD cell and if that is populated, returns that value … and so on. If it finds four blanks in a row then for that row it returns a blank.