If I use the formula: =UNIQUE(A1:A9) on the B1 cell, the column B will be filled with the unique appearances from A1 to A9. In other words: it will remove duplicates.
The problem is that if I want to order from A to Z of the column C, the formula will be moved to some other place, so it will stop working.
My workaround so far has been this:
However, you will be agree that it's not the most elegant solution.
I'd like to know if it's possible to use a formula in Z1 to print the output starting from Z3.
Is that possible?
I'd like to know if it's possible to use a formula in Z1 to print the output starting from Z3.
use in Z1:
={""; ""; UNIQUE(I3:I313)}
Related
I am trying to generate an arrayformula for the whole column but it does not work, when I use the same formula cell by cell, it generates correct value. Here is the formula for F1 cell:
=if(Iferror(vlookup($D1, INDIRECT("$"&"A"&MATCH(E1,$B:$B,0)+1&":$B"),2,false),"")=E1,"",Iferror(vlookup($D1, INDIRECT("$"&"A"&MATCH(E1,$B:$B,0)+1&":$B"),2,false),""))
I am trying to convert it into ArrayFormula like this and put it in F1:
=ARRAYFORMULA(if(Iferror(vlookup($D:$D, INDIRECT("$"&"A"&MATCH($E:$E,$B:$B,0)+1&":$B"),2,false),"")=$E:$E,"",Iferror(vlookup($D:$D, INDIRECT("$"&"A"&MATCH($E:$E,$B:$B,0)+1&":$B"),2,false),"")))
But this does not work and returns empty column, here is the sheet if you want to test it, you can find formula in column F:
https://docs.google.com/spreadsheets/d/13XLZvvdzK_mqr4Ous50cIEfernw2XrPJWvVgt1hFxtk/edit?usp=sharing
Please share your knowledge how to go about it as I am trying to learn formulas starting from basic level? Thank you.
when working with more than one condition, you can usually use FILTER for it. In this case, I used MAP to refer to both columns D and E, and used FILTER to narrow to the matches in A column, and then to those values that were further than the row of the MATCH of E value. Then, with INDEX I chose the first value of that resulting range.
=MAP(D:D,E:E,LAMBDA(d,e,IFERROR(IF(d="","",INDEX(FILTER(B:B,A:A=d,ROW(B:B)>MATCH(e,B:B,0)),1)))))
Unclear of the full scope but from your expected result scenario(in Column F) you seem to be pulling off second match(if any). well in that case try:
=BYROW(D:D,LAMBDA(dx,IF(dx="",,IFNA(FILTER(ARRAY_CONSTRAIN(FILTER(B:B,A:A=dx),2,1),{0;1})))))
I have a following formula in my google sheets
=TEXTJOIN(" -- ",TRUE,QUERY('sheetName'!B2:F,"SELECT F WHERE B = '"&$A3&"'"))
The formula is in a different sheet, same workbook though, let's call it "sheetResult". Basically it looks-up values and returns them if there is a match. There are two things I would like to achieve with it further. I need it to be an array so that it applies to all of the rows and I need it to return only the unique values found, I have tried the following but it does not work.
=ARRAYFORMULA(IF(A2:A = "" , , TEXTJOIN(", ",TRUE,UNIQUE(QUERY('sheetName'!B2:F,"SELECT F WHERE B = '"&$A2&"'"))) )) --> not sure what syntax to use
I tried filter but filter just returns all of the info stacked up, need the formula to return the data considering the rows in which the lookup value is held.
EDIT: Added a link to shared file to better describe the question.
I want to make the formula in Y3 on the "Students" sheet apply to all of the cells below it, much like an array formula does.
Example
After further studying your situation I came with a simple fix based on your original formula. I understand that you want to apply the Y3 formula to the whole table, but without altering its behaviour. I assume that the only moving part would be the students ID (Column A). Then you only need to modify your formula to lock the fixed variables with something like:
=TEXTJOIN(" -- ",TRUE,UNIQUE(QUERY('.data'!$B$2:$F,"SELECT F WHERE B = '"&A3&"'")))
After you write that on Y3 you would need to select it and drag it down to fill the table. Please leave a comment if you need further help.
Suppose my excel sheet looks like this:
Name
Houses
Cars owned
column D
John
3
3
=A&MAX(30,3)
Harry
2
4
..
Vik
5
1
..
..
p
k
..
...
q
n
..
In column D, I want to return the row in column A that corresponds to the larger of the two values in cells B2 and C2. So in cell D2, I would want to return "Vik" because the larger of the two values in B2 (3) and C2 (3) is 3. And the value in cell A3 is Vik.
So in order to arrive at my result, I would input something like ="A"&MAX(B2,C2) in D2.
But suppose my formula was a lot more complex and with different data.
=IFERROR(ArrayFormula(ADDRESS(MAX(index(IF($A$1:$D6=B7,ROW($A$1:$D6),""),,IF($A$1:$D6=B7,COLUMN($A$1:$D6)),"")),MAX(IF($A$1:$D6=B7,COLUMN($A$1:$D6),"")))),"")
and I wanted the result of the first chunk of the formula (from ADDRESS() onwards)
MAX(index(IF($A$1:$D6=B7,ROW($A$1:$D6),"") (which is 3, say) to be the row number that is input into
MAX(IF($A$3:$D3=B7,COLUMN($A$1:$D6),"")) for the range inside the IF condition.
(notice how $A$1:$D6 changed to $A$3:$D6)
So, going by the tabular example above, I would simply input MAX(IF("$A$"&MAX(index(IF($A$1:$D6=B7,ROW($A$1:$D6),""):$D6=B7,COLUMN($A$1:$D6),"")) and that should do the trick. Except it doesn't and I get a formula parse error which I cannot resolve.
Here is the specific excel sheet I'm working on: https://docs.google.com/spreadsheets/d/12U8U7Jp4FscobIvgr4_sADJB_oSdIHrboCk02cxF_u0/edit?usp=sharing
Can anyone see what I'm doing wrong? The solution, I think, should be simple enough but I can't seem to figure it out.
Sorry if it's a bit long but I've been struggling with this for a while now.
I hope this formula will help
=ARRAYFORMULA(IFNA(VLOOKUP(QUERY(TRANSPOSE(QUERY(TRANSPOSE(B2:C6);"select "&JOIN(",";"max(Col"&row(B2:C6)-1&")")));"select Col2+1 label Col2+1''");{row(A:A)\A:A};2;False)))
Solved using the indirect function and ampersand concatenation.
New function would be: =IFERROR(ArrayFormula(ADDRESS(MAX(index(IF($A$1:$D6=B7,ROW($A$1:$D6),""),,IF($A$1:$D6=B7,COLUMN($A$1:$D6),""))),MAX(IF(INDIRECT("$A$"&(MAX(index(IF($A$1:$D6=B7,ROW($A$1:$D6),""))))):$D6=B7,COLUMN($A$1:$D6),"")))),"")
I've been working at this for a bit.
I have tried many times different formula combos, using VLOOKUP to using INDEX & MATCH, even with an ARRAYFORMULA.
What I'm attempting to do is match a territory to return a state. Then be able to copy the formula down.
As of now when I copy the formula downwards it can only return the first find in the column.
Where did I go wrong? I'm sure this far too simple and I'm overthinking the entire thing.
I was hoping for something like the following formula to work:
=ArrayFormula(index(States,Match(TER 1,Territory,0)))
=ArrayFormula(index($D$3:$D$53,MATCH($B$3,$C$3:$C$53,0)))
Try a query instead. In cell F4 try the following formula:
=IFERROR(QUERY($C$3:$D$52,"select D where C='"&G$3&"'"),"")
You can even drag the formula from F3 to the right and all of the rest will auto-fill.
Functions used:
QUERY
Using google spreadsheets is there a way to evaluate a cell value as the row in a lookup operation? For example rather than =D2 to grab the value of D2, I want to evaluate the value of a cell and use it as the row to lookup another cell. I've looked at the google spreadsheet formula documentation and haven't been able to find a solution.
The below pseudocode illustrates what I'm trying to do.
A B C D
1 D
2 =[B1]2 10
3 =[B1]3 9
4 =[B1]4 8
Given the value of B1 is "D" I want cells B2, B3, and B4 to resolve to 10, 9, and 8 respectively.
You might be looking for something like this:
=INDIRECT(INDEX(B$1;1;1)&ROW())
the INDEX(B$1;1;1) gets content of B1 cell (the 1;1 is obligatory parameter, since you can feed INDEX with range and means: 1st row in range;1st column in range which is D
ROW() returns current row number, be it 2, 3 etc.
& concatenates both value, so the result is processed like "D" & "2" => "D2"
INDIRECT(reference) returns reference to a cell or an area (in text form) for which to return the contents.
see https://support.google.com/drive/table/25273?hl=en
Still, depending on what is the original problem, there might be better solutions. Above one is just straightforward answer to your question.
Bearing in mind the correctness and helpfulness of PsychoFish's advice on the use of INDEX() with INDIRECT(), and on the limited usefulness of any one solution for all problems, I think the following formula will work as well in this particular case:
=INDIRECT(B$1&Row())