I have installed the Sublime Alignment plugin. It works well for aligning the first character (default is =). How can I align this block in Sublime Text 2 in one shot :
INSERT INTO user VALUES (1, 'Alpha', 'Beta', 'Delta');
INSERT INTO user VALUES (2, 'A', 'B', 'D');
to look like :
INSERT INTO user VALUES (1, 'Alpha', 'Beta', 'Delta');
INSERT INTO user VALUES (2, 'A', 'B', 'D');
Even if I add , as the alignment character in sublime alignment, it only works for the first occurence of ,
Align Tab is quite versatile & can accomplish the alignment and it's not limited to just first character.
Install
Related
For example I have this set of data below:
Header 1 Header 2
Mouse 5
Elephant 4
What I want to happen is for the word "Mouse" to repeat 5 times and the word "Elephant" to repeat 4 times from top to bottom in Column C.
The output will look something like this:
Header 1 Header 2 Header 3
Mouse 5 Mouse
Elephant 4 Mouse
Mouse
Mouse
Mouse
Elephant
Elephant
Elephant
Elephant
How to do this in Google Sheets?
Thank You
Try the below formula:
Assuming your data range is A2:B and you are entering the formula in C2, if not then you can change the range accordingly
=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(
REPT(A2:A&",", B2:B), ,999^99), ","))))
Supposing that your "Header 1" is in A1 and the rest of your posted sample is in A:B, place the following formula in C1 of an otherwise empty Column C:
=ArrayFormula({"Header 3"; QUERY(FLATTEN(SPLIT(FILTER(REPT(A2:A&"~",B2:B),A2:A<>""),"~",1,1)),"Select * WHERE Col1 Is Not Null")})
This formula will produce the header text (which you can change within the formula as you like) and all results.
REPT will repeat anything in A2:A (with a tilde appended to the end) B2:B times to form virtual single-cell strings.
FILTER will make sure only occupied rows are included in the REPT function.
SPLIT will split those repetitive strings into separate horizontal cells at those intermittent tildes.
FLATTEN will take all of the results of the SPLIT and form one column from them (spaces and all, since the number of cells per virtual row will differ depending on the requested number of repetitions).
QUERY will purge any empty rows that would have otherwise appeared in the FLATTEN results.
ArrayFormula is necessary because the formula is processing a range as opposed to a single row's data.
My question is simple, but I am afraid that there is no solution for this.
I want to create 3 combo boxes in 3 lines in a column.
The combo boxes have only 3 values.
If I select an item from the combo box, then the other two combo boxes should have only the remaining 2 items to select.
If I select an item from a second combo box, then the last one should have only the remaining 1 item to select.
If I clear the first combo box selection, then the first and last combo boxes should have only the remaining 2 items to select again.
Is this possible somehow in Google Sheets?
There definitely is a solution for this, you're just going to need some separate formulas.
Reserve 9-12 cells (depending if you want headers) and label them so that you know which dropdown they refer to (i.e. box 1, box 2, box 3).
Under Box 1, simply list your 3 values.
Under Box 2, enter the formula =filter(C2:C4, A1<>C2:C4) replacing C2:C4 with the range of Box 1's three values, and A1 with the cell of the first dropdown box.
Under Box 3, enter the formula =filter(D2:D4, A2<>D2:D4), replacing D2:D4 with the range of Box 2's three values, and A2 with the cell of the second dropdown box.
Now, just insert dropboxes and set the list range to the three ranges from above. The formulas will cause the cell values to change, and in turn change the dropbox values.
And that's it! If you would want them to all be independent, as it seems the last part of your question asks for,(ex. choosing a value in Box 2 first and then Box 1 and 3 changing accordingly) it would just require some longer formulas. I can work on that, but i wanted to get this to you first to be sure this is what you were asking for.
Spreadsheet: https://docs.google.com/spreadsheets/d/15YLW7qL685FJjXKPE0uWTM50YhygpOZqK0UW4u48atI/edit?usp=sharing
I have made a guest list sheet in Google Sheets with two columns, one of name and one of attendance. The attendance column can have two values, either X (when people don't come) or a number (mostly 1 or 2, but safe to say always bigger than 0).
I've already created a custom formula marking the whole line (including the name) red if there is an X in the second column.
This formula works like a charm!
I now want to do the same thing, but making the whole line (including the name) green if there is a number placed in the column. I've tried replacing the X in the custom formula with 1, 2, 3 etc (also with colons and semi-colons) but that doesn't work.
Does any of you know what I need to do?
Please select ColumnsA:C and: Format > Conditional formatting..., Format cells if... Custom formula is and:
=and(isnumber($C1),$C1<>0)
with green fill for Formatting style and Done.
(Assumes 2 etc are Number format.)
I have a column(A) with cells of words where I want to highlight words that are used in other Columns containing sentences not single words. How is this possible?
With conditional formatting and a custom formula
=regexmatch(B1, join("|", filter($A:$A, len($A:$A))))
it worked that the cells in Column B or C where highlighted whenever they used a word from the cells of column A, but I need it the other way around.
Cells in column A should be highlighted whenever words from there are used in sentences in Column B or C
In this example, Column A contains the words and the words should be highlighted if they are used in Sentences in all rows of Column B or C.
Column A:
Sausage
Wiener
Brat
Column B:
I like Sausage
I don't like Steaks
Column C:
I like Brat
Here is my public Spreadsheet:
https://docs.google.com/spreadsheets/d/1ARDvwRJAPG4uXL-IyT4Qv3P0RQMFDj4OviM3GKK5Blg/edit#gid=0
=AND(LEN(A2),SUMPRODUCT(IFERROR(FIND(A2,$B$2:$E$3))))
Apply to:
A2:A
I believe, this Custom Formula for the range B2:B1000 should work:
=AND(LEN(A2),SUM(ArrayFormula(--REGEXMATCH(B2:E2,A2)))>0)
Select the cells you want to format.
Click Format and then Conditional formatting.
Under the "Format cells if" drop-down menu, click Custom formula is.
Click formula and add the formula
Click Done.
Instructions
Notes:
Check LEN(A2) to skip empty values
ArrayFormula(--REGEXMATCH(B2:E2,A2)) will return all matches with RegexExtract. Double minus -- is to convert boolean true to 1, and false to 0.
second condition SUM gives 1 and more if at least one match was found.
Anyway, I have a table in Google Spreadsheets that has a set of rows which each contain a name (Column A) and two Yes or No values (Columns G and H).
I would like a way to conditionally format the rows. I have been trying to learn the formatting but I feel this is well out of my league. The way I would like it all to be formatted is only in Column A. If G says "Yes" and H is empty, then yellow. If G says "Yes" and H says "No", red. If G says "Yes" and H says "Yes", green.
If it helps, here is a chart:
G H
Y -- Yellow
Y N Red
Y Y Green
An explanation of how it all works would also be much appreciated but if you only have the solution on how to do it, I will gladly take that.
METHOD 1 - Conditional Formatting Only
The easiest way to do this, using Conditional Formatting is as follows:
Select "Format >> Conditional Formatting":
These IF statements will be used color the cells Yellow, Red, and Green, respectively.
=IF(AND(G2="Yes",H2=""),"True")
=IF(AND(G2="Yes",H2="NO"),"True")
=IF(AND(G2="Yes",H2="YES"),"True")
METHOD 2 - New Column, using f(x), and Conditional Formatting
The code used to generate the text "Yellow," "Red," and "Green" is as follows (broken up in 2 lines only for easier readability):
=IF(AND(B2="Yes",C2=""), "Yellow",IF(AND(B2="Yes",C2="No"), "Red",
IF(AND(B2="Yes",C2="Yes"), "Green")))
This is a nested IF statement that will examine your "Yes"/"No"/null column cells. This statement looks for the conditions you specified and returns either "Yellow," "Red," or "Green" in a separate column.
Since your IF statement will output either "Yellow," "Red," or "Green," all you'll have to do is set your Conditional Formatting to look for these words and color the cell accordingly.
A great resource to learn more is the Google spreadsheet function list.
I've got it for you. It can be made using the conditional formatting in Google Sheet.
A Screen Shot attached
Right click your cell A, apply conditional formatting
Just apply it across your range in column A1:A500 something
and choose the "Format cells if..." and choose custom formula
(Just click Add another rule after each one so you don't have to repeat the range)
=IF(AND(G60="Yes",H60=""),"True") //Change the color to Yellow
=IF(AND(G60="Yes",H60="No"),"True") // Change the color to red
=IF(AND(G60="Yes",H60="Yes"),"True") // Change the color to green
You will have 3 rules of conditional formating
replace G60 and H60 with the starting row number
Edit ------------------ Forgot to add the explanation
The formula
IF(AND(G60="Yes",H60=""),"True")
"IF" is to check IF something is this or not. I added the "AND" so that we could put in 2 condition, since we need both conditions to be satisfied. and therefore the formula above in written form would be
IF(IF) BOTH(AND) G60 and H60 is "Yes" and "Empty" respectively, then it is True. So it will become the color I chose.
There might be another way to write the codes but this works :)