Google Spreadsheet - MIX several column values - google-sheets

Hello I have 3 or more columns in Google Spreadsheet like this:
CITY
SEASON
COLOR
ROME
SUMMER
WHITE
PARIS
SPRING
BLUE
LONDON
WINTER
What I need is a combination of all values in the 3 columns such as:
ROME SUMMER WHITE
ROME SUMMER BLUE
ROME SPRING WHITE
ROME SPRING BLUE
ROME WINTER WHITE
ROME WINTER BLUE
PARIS SUMMER WHITE
PARIS SUMMER BLUE
PARIS SPRING WHITE
PARIS SPRING BLUE
PARIS WINTER WHITE
PARIS WINTER BLUE
LONDON SUMMER WHITE
etc...
Consider that columns could be 2 or more.
Have any solution? Thank you!

Assuming the header "City" is in A1 and the rest of your raw data example follows suit (i.e., everything is in A1:C), this should do it:
=ArrayFormula(FLATTEN(FILTER(A2:A,A2:A<>"")&" "&TRANSPOSE(FLATTEN(FILTER(B2:B,B2:B<>"")&" "&TRANSPOSE(FILTER(C2:C,C2:C<>""))))))
FILTER limits each range to only those that contain data.
TRANSPOSE in each case flips one of the vertical ranges to a horizontal one to form a virtual grid that can be filled with combinations.
The rundown here is that ColB and ColC words are concatenated with a space first. FLATTEN then turns that grid of combinations into a single column (as if you only ever had ColA and ColB-new). Then this process is repeated, with ColA and the newly formed ColB-C combos, which are once more FLATTENed to form the final one-column list.

Use the join built in function of GoogleSheets like so:
=JOIN(" ",A1,B1,C1)
you can see the documentation for the join function here
JOIN function
Concatenates the elements of one or more one-dimensional arrays using a specified >delimiter.
Alternatively, if you wish to do this for multiple rows at the same time, you may use an Array formula like so:
=ARRAYFORMULA(A1&" "&B1&" "&C1)

Related

Is it possible to do Alternating Color Formatting with same color for repeated rows [duplicate]

So I have a spread sheet that has a bunch of data in it... The first column is the state, second is a name. What I want to do is have the rows alternate blue/red/blue/red (to make it easy to read) but I don't want it to alternate EVERY row like evens/odds. What I want is for each state to have a different color. So all the rows with AL blue, then CA red, CT blue, etc... This is just a basic example. Obviously here I could just hardcode the 50 states, but is there any way to automate this process so that basically every time the state changes, I switch colors?
State Name
AL John
CA Bill
CA Joe
CA Chad
CT Mary
VA Beth
VA Dani
In Google Sheets you can count how many unique names there are down to the current cell and test if it's an odd number
=isodd(countunique(A$2:A2))
Apply this to the range as a custom formula in conditional formats with the first fill colour.
Then apply
=iseven(countunique(A$2:A2))
as another rule with the second fill colour.
In Excel it's more difficult to do this, would end up with something like
=ISODD(SUM(--(FREQUENCY(MATCH(A$2:A2,A$2:A2,0),MATCH(A$2:A2,A$2:A2,0))>0)))
and
=ISEVEN(SUM(--(FREQUENCY(MATCH(A$2:A2,A$2:A2,0),MATCH(A$2:A2,A$2:A2,0))>0)))
Note this only works if the data is sorted by state as in your test data.
You can use Format as a table with the following procedure:
Open the worksheet.
Select the cell range that you want to shade, or
press Ctrl+A to select the whole worksheet.
Click the Home tab.
In the Styles group, click Format as Table, and then click the style of
formatting that you want.
In the Format as Table dialog box, click OK.
Also, as an alternative you can use Conditional Formatting.

Conditional formatting - coloring a row based on whether a cell within the row matches a cell outside the range

Wanting to apply conditional formatting to a range within a Google sheet, but the dependency is based on whether a cell within the range matches a cell outside the range.
A B C
1 John
2 Bob
3 Phil
4
5
6 NZ John Rugby
7 Aust John Soccer
8 NZ Bob Tennis
9 NZ John Baseball
10 Aust Phil Tennis
Above is a simplified sheet. I have 3 unique names in A1, A2 & A3. Below that info is a chart of people from a work group.
I want to apply conditional formatting to the chart so that all the rows containing John are shaded red, rows containing Bob are shaded blue and rows containing Phil are shaded green.
Most tutorial videos are based on the assumption that the conditional formatting required would need a formula like =$B6="John" with a range of A6:C10 and shading it red.
I'm looking for something a bit more generic so the formula isn't listing specific names, rather a cell such as A1. So the formula might look like =$B6=A1 with a range of A6:C10 and a shade of red.
Help?
red color: =$B6=$A$1
blue color: =$B6=$A$2
green color: =$B6=$A$3

Find similar values and move cells in Google sheet

Basically, I have Google Search data for two different months in one Google Sheet. I'm trying to align similar terms with their data for both months.
Here's the Google Sheet -> https://docs.google.com/spreadsheets/d/17Xu5_37aLJW3yBCJ8SbquexNHShMwsApF-2BpBEhpcA/edit#gid=0
As you can see in the Sheet, we have data in Black and Blue color, Black represent July and Blue represent August.
In the sheet, you can see A8 and A9 search terms are also found in Blue (August) at G6 and G7.
How do I move the data so that both months search term aligns?
it's either first one or second one you seek:
=ARRAYFORMULA(IFERROR(VLOOKUP(A:A, G:L, {1,2,3,4,5,6}, 0)))
=ARRAYFORMULA(IFERROR(VLOOKUP(G:G, A:F, {1,2,3,4,5,6}, 0)))

How to alternate colors based on first column of google sheet

So I have a spread sheet that has a bunch of data in it... The first column is the state, second is a name. What I want to do is have the rows alternate blue/red/blue/red (to make it easy to read) but I don't want it to alternate EVERY row like evens/odds. What I want is for each state to have a different color. So all the rows with AL blue, then CA red, CT blue, etc... This is just a basic example. Obviously here I could just hardcode the 50 states, but is there any way to automate this process so that basically every time the state changes, I switch colors?
State Name
AL John
CA Bill
CA Joe
CA Chad
CT Mary
VA Beth
VA Dani
In Google Sheets you can count how many unique names there are down to the current cell and test if it's an odd number
=isodd(countunique(A$2:A2))
Apply this to the range as a custom formula in conditional formats with the first fill colour.
Then apply
=iseven(countunique(A$2:A2))
as another rule with the second fill colour.
In Excel it's more difficult to do this, would end up with something like
=ISODD(SUM(--(FREQUENCY(MATCH(A$2:A2,A$2:A2,0),MATCH(A$2:A2,A$2:A2,0))>0)))
and
=ISEVEN(SUM(--(FREQUENCY(MATCH(A$2:A2,A$2:A2,0),MATCH(A$2:A2,A$2:A2,0))>0)))
Note this only works if the data is sorted by state as in your test data.
You can use Format as a table with the following procedure:
Open the worksheet.
Select the cell range that you want to shade, or
press Ctrl+A to select the whole worksheet.
Click the Home tab.
In the Styles group, click Format as Table, and then click the style of
formatting that you want.
In the Format as Table dialog box, click OK.
Also, as an alternative you can use Conditional Formatting.

Highcharts: stacked column with grouped categories

I'm trying to do a chart with stacked columns but for each column having different entries. I will explain myself better.
I would like to use the demo of Highcharts:
http://www.highcharts.com/demo/column-stacked
But:
In the demo, the series are always the same: John, Jane and Joe. What I need, is to have different series for each column (xAxis category). I tried the plugin "https://raw.github.com/blacklabel/grouped_categories. This is fine to have multiple series grouped, but the grouped series are split into multiple columns: I need just one stacked column for each multiple series.
For example:
I want to group the population living in the west coast: I need a stacked column with the data from CA, WA and so on, And the column should clearly show every state, one on the top of the other. Then, in another column I want to group the population of the east coast, grouping in one column FL, NY and so on.
Can someone please help me?
Many thanks
Vignus

Resources