Given the following table:
I was able to find a formula that adds a blank row after each row for the 'Track Name' column, which allowed me to populate the new table (see expected output) correctly with ArrayFormula into merged cells.
={"Track Name";ARRAYFORMULA(IFERROR(VLOOKUP(ARRAY_CONSTRAIN(ROW(Data!A2:A),COUNTA(Data!A2:A)*2-1,1), {IF(LEN(Data!A2:A),ROW(Data!A1:A)*2,),Data!A2:A},{2},FALSE)," "))}
Now, is it possible to then use ArrayFormula to retrieve the artists & features while skipping rows to allow for user input?
Expected output:
I could probably set this up using a script, but if I can avoid that then I think that'd be better...
Try:
=ArrayFormula(iferror(vlookup(array_constrain(row(A2:A),COUNTA(A2:A)*2-1,1),{if(len(A2:A),row(A1:A)*2,),ArrayFormula(split(ArrayFormula(B2:B & "," & C2:C),","))},{2,3,4,5},false)," "))
Result:
For the merged cells for the Track Name column I'm assuming you've formatted this manually.
To explain this I've used this formula from the reference link:
=ArrayFormula(iferror(vlookup(array_constrain(row(A2:A),COUNTA(A2:A)*2-1,1),
{if(len(A2:A),row(A1:A)*2,),B2:C)},{2,3},false)," "))
I replaced the range B2:C with the formula from this post ArrayFormula with TextJoin of a row of columns to join columns B and C and split them to multiple columns. I also changed the {2,3} to {2,3,4,5} (you need to change this if you are expecting more columns).
NOTE: This does not work for merged cells it is only displaying the value on the left cell if you have 2 horizontally merged cells.
Please see the reference link below if you need more information on the formula used.
Reference:
Refer to this link for more detailed explanation: Insert Blank Rows
Related
So I have two rows:
ID
TagDog
TagCat
TagChair
TagArm
Grouped Tags (need help with this)
1
TRUE
TRUE
TagDog,TagArm
Row 1 consists mainly of Tags, while rows 2+ are entries. This data ties ENTRIES to TAGS.
What I'm needing to do is concatenate/join the tag names per entry. For example, look at the last column above.
I suspect we could write a formula that would:
Create an array of non-empty cells in the row. (IE: [2,4])
Return it with the header row A (IE: [A2,A4])
Then join them together by a comma
But I am unsure how to write the formula, or if this is even the best approach.
Here's the formula:
={
"Grouped Tags (need help with this)";
ARRAYFORMULA(
REGEXREPLACE(TRIM(
TRANSPOSE(QUERY(TRANSPOSE(
IF(NOT(B2:E11),, B1:E1)
),, COLUMNS(B1:E1)))
), "\s+", ",")
)
}
The trick used is called vertical query smash. That's the part:
TRANSPOSE(QUERY(TRANSPOSE(...),, Nnumber_of_columns))
You can find a brief description of this one and his friends here.
I wasn't able to create a single formula that would do this for me, so instead, I utilized a formula inside of Sheets' Find/Replace tool, and it worked like a charm!
I did a find/replace, replacing all instances of TRUE with the following formula:
=INDIRECT(SUBSTITUTE(LEFT(ADDRESS(ROW(),COLUMN()),3),"$","")&"$1")
What this formula does is it finds the cell's letter, then gets the first row of the cell using INDIRECT.
Breaking down the formula:
ADDRESS(ROW(),COLUMN()) returns the direct reference: $H$1
LEFT("$H$1",3) returns $H$
SUBSTITUBE("$H$","$","") replaces the dollar signs ($) and returns H
INDIRECT(H&"$1") references the exact cell H$1
Now, I can replace all instances of TRUE with that formula and the magic happens!
Here is a video explanation: https://youtu.be/SXXlv4JHDA8
Hopefully, that helps someone -- however, I would still be interested in seeing what the formula is for this solution.
I need to transpose parts of a table row by row. The following example illustrates what the result needs to look like:
I tried different combinations of arrayformula(), flatten() and transpose(), succeeded with getting the last column right with =arrayformula(FLATTEN(B4:C)), but need now help with fixing this.
Link to table
Try this in row 2 of the example screenshot:
={flatten({A2:A,A2:A}),arrayformula(flatten({if(A2:A<>"",B$1,),if(A2:A<>"",C$1,)})),flatten({B2:C})}
Or if you want the column headings, put this in row 1:
={"A","B","C";flatten({A2:A,A2:A}),arrayformula(flatten({if(A2:A<>"",B$1,),if(A2:A<>"",C$1,)})),flatten({B2:C})}
The new column 'C' ends up being a mixed data type, so be careful if you run a future query on these results as it doesn't like mixed data.
For local implementation (as per your initial screengrab, EU locale file), try this in cell E4 - since the formula sits in row 4, the array range needs to go from 4 (A4:A):
={flatten({A4:A\A4:A})\arrayformula(flatten({if(A4:A<>"";B$3;)\if(A4:A<>"";C$3;)}))\flatten({B4:C})}
Alternatively, if you want column headings, try this in cell E3 - the array range is still A4:A because "A"\"B"\"C"; puts headings in row 3, ; is a return, then the rest of the formula targets data from row 4 down:
={"A"\"B"\"C";flatten({A4:A\A4:A})\arrayformula(flatten({if(A4:A<>"";B$3;)\if(A4:A<>"";C$3;)}))\flatten({B4:C})}
If you want to limit the array range to a specific row rather than working down the entire sheet (eg. row 20), then A4:A would need to be A4:A20.
This is a basic SPLIT(FLATTEN( problem.
Arrayformula() can always exist on the outside of a formula and will apply to the whole thing.
This is on a new tab in your sample called MK.Help:
=ARRAYFORMULA(QUERY(TO_TEXT(SPLIT(FLATTEN(Data!A2:A&"|"&Data!B1:C1&"|"&Data!B2:C);"|";0;0));"where Col1<>''"))
I have a very hard problem to solve, which must be completed with a formula (not a script).
Basically, the Raw input column needs to be dynamically filled down until it hits the next piece of text.
Here's an example file with includes the expected output.
https://docs.google.com/spreadsheets/d/1ibqCvY39NlhCRWsbBdxKITUUpVpp9wXdEz44T-pHDY0/
Is it even possible to achieve?
Thanks
This will work based on your ask, assuming that A2 is never blank, place this in the first row of data (not header):
=ArrayFormula(IF(A2:A<>"", A2:A, B1:B))
It checks to see if there is a value in column A, if there is, it fills that column, if not, it copies the cell above.
Delete everything in Column B (including the header) and place the following formula in B1:
=ArrayFormula({"Header";VLOOKUP(FILTER(ROW(A2:A),ROW(A2:A)<=MAX(FILTER(ROW(A2:A),A2:A<>""))),FILTER({ROW(A2:A),A2:A},A2:A<>""),2,TRUE)})
Here is a basic explanation of how this formula works:
A virtual array is created between the curly brackets { }; this virtual array contains a header and all results. You can change the header name to whatever you like.
VLOOKUP looks up every row number that is less than or equal to the highest row number that contains text in A2:A. Each of these qualifying rows is looked up in a second array that contains only the row numbers and Column-A data from non-blank rows, returning the data itself. Since rows are in perfect ascending order and the last parameter of VLOOKUP is set to TRUE, all blank rows in the first array will "fall backward" to find the most recent row that did have something in Column A.
Hello I would like to check for duplicate rows, not just a cell, in google sheets, i would like to apply this formula in conditional formatting so it would highlight the cell
Here is a sample of what i want to catch
I would like to catch a duplicate row,group,or pair of cells in exact order. Can anybody help me with the formula?
I tried searching and there seems to be no article about it yet, I also tried using countif on both rows and multiply them, but that does not solve it being a pair.
Let's say you have the following data:
https://ibb.co/sFhjN34
First, range select A1:B1001.
Then, paste the following formula in the custom formula bar.
=AND(A1<>"",COUNTIF(ARRAYFORMULA($A:$A&$B:$B),index(ARRAYFORMULA($A:$A&$B:$B),ROW($A1),))>1)
Explaination:
ARRAYFORMULA($A:$A&$B:$B)
This is creating a virtual array which concat two columns A & B.
E.g. juice crackers -> juicecrackers
index(ARRAYFORMULA($A:$A&$B:$B),ROW($A1),)
Since conditional formating will loop through all rows given the starting range you specify earlier (A1:B1001), this part is trying to loop through ROW($A_) such that index(ARRAYFORMULA($A:$A&$B:$B),ROW($A_),) will return the combined word.
COUNTIF(ARRAYFORMULA($A:$A&$B:$B),index(ARRAYFORMULA($A:$A&$B:$B),ROW($A1),))>1)
Count every combined word that it specified in this array ARRAYFORMULA($A:$A&$B:$B)
If it countup more than 1, it means duplicated.
A1<>"" For those blank cells, we ignore it.
Combine the two conditions. AND(A1<>"",COUNTIF(ARRAYFORMULA($A:$A&$B:$B) ....)
It's not quite as perfect as you'd like, but I think this is a start:
=AND($A1=$A2,$B1=$B2)
This doesn't highlight the last row of any matches it finds, but it might be serviceable for what you want (ex. if Row 1 through Row 3 match, it will only highlight Row 1 and Row 2).
Just change the columns to match the two you're working with, and then if you want it to highlight the entire row, change the Apply to range to A1:Z or however many columns you have.
I'd like to achieve what's in the Desired Output column in the image below. I need to take what's in row 1 (id1, id2, etc.), add ":" to that, then concatenate it with the values under each of the Field columns, add "|" to each ID-Value pair, and get that all together into one cell. I need the formula to also work for empty cells, as the number of fields to concatenate together is dynamic.
So far I've tried a big CONCATENATE formula in one cell, but I can only get it to work for as many non-blank cells as I include in the formula.
Thanks in advance!
google-sheets
Use JOIN:
=arrayformula(join("|",filter($B$1:$E$1& ":" & B2:E2,B2:E2<>"")))
excel-formula
Use TEXTJOIN
=TEXTJOIN("|",,IF(B2:E2<>"",$B$1:$E$1 & ":" & B2:E2,""))
This will be an array formula and must be confirmed with ctrl-Shift-Enter instead of Enter when exiting edit mode.