Referencing a cell's row value using a formula - google-sheets

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),"")))),"")

Related

Google Sheets // Is it possible to use a cell for value Input, but also as Output from a different input?

So what I'm trying to accomplish here is having column (B) as Input.
Ascension: B5= Input, then it sums C5=B5/1000 for volume conversion.
Ullage in m3's.: D3=B3/C5
Ullage in mm's: D4=B4*C5
Row 2 and 5 are irrelevant for the request.
My question is: Can I Input a value in B3 so that Divides by C5 and shows in D3 like now, BUT, also updates D4 and therefor automatically B4.
Let's say my input in (B3) is 100 divided by 2 (C5) = (D3)50. Now I would like for (D4) to take over that 100 from (B3) and also divide that by 2 to show in (B4). BUT, now when I input a value into (B4), I want it to multiply by (C5) and do the same trick with D3 and B3.
Basically, a cross-working calculator based on what input value I have that updates the other to not get confused reading the data.
Might be too complex, but thought I'd give it a shot here. Thanks.
Google, Stackoverflow.com, Youtube, Messing around myself..
You could sort it out with hidden columns, and values that expand to the next column in which you'd like to have your result or input your value.
Instead a formula: =B3/B4 you'd have ={",",B3/B4}
So, if you manually insert a value in the right column, the formula in left column won't expand. As an example I've created a very dummy calculator of sides and hypothenuse. In B1 (column B in red would be hidden) I have:
={"","Res: "&(C3^2-C2^2)^(1/2)}
And so on in the next rows. In this picture I've inserted manual values in C1 and C2, so C3 has a result:
[]
1
And another example in another row:
You can test it out here and the extrapolate it to your formulas,
(I've erased the part with "Res. " so the result is an actual number, it was just for easier view in my examples):
https://docs.google.com/spreadsheets/d/1ZaEEGWtLU-LXBmg-xy80Ps_biuYhb8WxZBs0g1tGE00/edit?usp=drivesdk

Summing specific values in a joined list

I am having some difficulties summing up some values in Google Sheets. In my spreadsheet, from multiple other tabs, values and bonuses are combined into one cell (Cell B1 in this example). The format of each "unit" of data is Name,5%xxx (Where "Name" is the name of the item, "5%" represents the sum I want to add, mostly always a percentage, and "xxx" separates one unit from the next). As you can see in cell B1, there are two instances where "Parkour" receives a bonus to sum up (from different sources).
Parkour,5%xxxParkour (Subskill: Sense of Balance),10%xxxParkour,2%xxx
Parkour
0.07
Parkour (Subskill: Sense of Balance)
H2H Combat: Parkour
The formula in cell B2 is:
=IFERROR(SUM(ARRAYFORMULA(IFERROR(VALUE(MID(FILTER(SPLIT(TEXTJOIN("",TRUE,filter(B$1,regexmatch(B$1,$A2)=TRUE)),"xxx"),SEARCH($A2,SPLIT(TEXTJOIN("",TRUE,filter(B$1,regexmatch(B$1,$A2)=TRUE)),"xxx"))),len($A2)+2,1000)),""))),"")
(Dragged down through the rest of the list) (Could not figure out how to make the formula "in line" on the question.)
Expected Results:
B2 = .07 (Working)
B3 = .1 (Not working)
B4 = Blank (Working)
The goal of the formula is to look into cell B1, and split everything out by "xxx". Then, filter the array of items with only exact matches with the line item in column A, then split again by the comma and add up those values. It worked for the first line item, but not the second. (Unsure why, but I strongly believe it has something to do with the parenthesis. When I removed the parenthesis from the name in Column A (and adjusted cell B1 to not have parenthesis), it worked. However, given the structure of the data, parenthesis are required, and I need to find a way for it to work with them.)
When I removed the IFERROR wrap around it in cell B3, I get this error note:
Function SUM parameter 1 expects number values. But " is a text and cannot be coerced to a number.
Any help is greatly appreciated.
You may find useful combining SPLIT with QUERY like this. It will group names and sum percentages:
=QUERY(INDEX (IFERROR(SPLIT(FLATTEN(INDEX(SPLIT(B1:B100,"xxx"))),","))),"SELECT Col1,SUM(Col2) where Col1 is not null group by Col1")
PS: invented a couple of extra line
UPDATE
I've thought you had another goal, try this formula. Having the previous chart generated by QUERY, I used VLOOKUP to match first column and return second one:
=INDEX(IFERROR (VLOOKUP(A2:A,QUERY(INDEX (SPLIT(FLATTEN(SPLIT(B1,"xxx")),",")),"SELECT Col1,SUM(Col2) where Col1 is not null group by Col1"),2,0)))

Google Sheets: Print output in another cell

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)}

google sheets, use formula output for next formula

I'm trying to CONCATENATE two cells in order to compare the results so that I can search by them, however the values of the two CONCATENATE outputs are different as one inputs is coming from the another formula.
Screen shots attached
I'm basically trying to compare the start time and channel number from A and B, with the data from G and H, so that I can update D with the relevant information in F (in the same format as A).
I first convert the EPOC time to human time readable, but when i try and CONCATENATE with the channel number, I get a different value to when i do that with A and B.
formula for c2 =CONCATENATE(A2,B2)
formula for i2 =G2/86400000+date(1970,1,1)
formula for k2 =CONCATENATE(G2,H2)
As you can see, the values for c2 and k2 are different event though a2 and i2 are the same (looking).
I've tried using CELL, INDEX, and INDIRECT but just can't seem to get it right, and I've tried various formatting options
Hopefully i've explained this right. Any solution welcome
raw data csv here START ,CHANNEL,concat,end?,,EndDateTime epoc,startDateTime epoc,channel,converted start,converted end,concat
12:58:00 AM,10,,,,1520391600000,1520382480000,7,,,
12:28:00 AM,7,,,,1520395200000,1520384280000,10,,,
So you have a couple of issues here.
CONCATENATE(A2,B2) will never equal CONCATENATE(I2,H2) because the values in A2 (12:58) and B2 (10) do not equal the values in I2 (12:28) and H2 (7). I think you meant to compare A2,B2 to I3,H3
A2 (12:58) does not equal I3 (12:58). You'll see this for yourself if you convert both to the date or number formats. The date value of A2 is 12/30/1899, the default when you enter only a time in the cell. The date value of I3 is 3/7/2018, because you converted the exact date and time from the EPOCH value.
For the two concatenations to equal each other, you need to resolve the issues above. You can do this by adding a date to column A's values.
On another note, I think there are better ways of populating column D based on the data in column F. A simple Vlookup should do the trick, once you resolve issue #2 above.

Google spreadsheet formula to resolve string as a cell

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())

Resources