I have a column in Google sheets that contains some text with a country code like US, JP, MX etc... somewhere in the text. I want to create another column next to it where it shows only the country code without the rest of the text.
The input looks like any of the following examples: "editing JP data", "JP data edits", "edited data for JP". The country code might be part of other data in some cases but as part of a word, not on its own...
I managed to extract the code for one country with a formula like =REGEXEXTRACT(F2,"JP") but I haven't managed to combine more than one regextract formulas. Any help would be greatly appreciated.
try:
=ARRAYFORMULA(IFERROR(REGEXEXTRACT(F2:F, "JP|US|MX")))
Related
I'm a google sheets beginner and need some help. I am using a sheet that is populated by a google form, so it's a bit tricky for me.
The google form allows users to select up to three options - red, blue, green. They must select one and can select three, so the output in column A can be "red" or "red, blue" or "red, blue, green" or any combination.
I've figured out how to split the answer combination using the formula =ARRAYFORMULA(trim(SPLIT(A2, ","))) so I get the individual outputs without the commas (that the google form returns) across up to three columns.
But - since it's a google form, I also need to have this formula automatically pasted as new rows are added to the sheet from the form. I can't figure out how to do a "double" array formula (for additional columns for data output and additional rows as data input) or if that's even an option or if I'm missing something here. Any help? thank you!
use in row 1:
={"formula", "header", "row"; ARRAYFORMULA(TRIM(IFERROR(SPLIT(A2:A, ","))))}
or in row 2:
=ARRAYFORMULA(TRIM(IFERROR(SPLIT(A2:A, ","))))
fully dynamic formula for row 1 would be:
=ARRAYFORMULA({"fx", IFERROR(REGEXMATCH(TRANSPOSE(ROW(
INDIRECT("A2:A"&COLUMNS(SPLIT(A2:A, ","))))))); IFERROR(SPLIT(A2:A, ","))})
I have a spreadsheet with responses from a Google Form. They sign up for one of our trivia games, then I make a spreadsheet for each game. I wrote a FILTER function in the corresponding Google Sheet that gives me a list of all the players' names.
What I need is a function to reference the team name from the Responses sheet and give me the information in my filtered game sheet. I would like a function rather than a Javascript script to run manually. I am certain this can be done but the function methodology is escaping me.
As an example, I have created a spreadsheet in Google Sheets with some data. Can someone help me write a formula to put team names in "The Office" tab? Thanks in advance.
https://docs.google.com/spreadsheets/d/1F2bgvHXqA2wNUa98rfESWTeK22va1RMQUjnk6ma2AeA/edit?usp=sharing
In B2 try this formula
=ArrayFormula(if(len(A2:A), vlookup( match("*"&A2:A&"*", 'Form Responses'!C:C, 0), {row('Form Responses'!A:A), 'Form Responses'!B:B}, 2, 0),))
and see if that helps?
Looks like you need a VLOOKUP which grabs the value of the matching row of whatever criteria you specify. The only issue was that VLOOKUP requires the column of values being returned to be after the "lookup column" which meant moving the team names column to column D.
Here is the formula: =VLOOKUP("*"&A2&"*",'Form Responses'!C$2:D$23,2, FALSE)
I also went ahead and implemented it in your linked spreadsheet.
use in B2:
=ARRAYFORMULA(IF(A2:A="",,IFNA(VLOOKUP("*"&A2:A&"*", 'Form Responses'!C2:D, 2, 0))))
On the paper it was simple to do, but at the end I'm stucked.
Herebelow the chart I would like to produce (I took an easy example to understand the objective to reach):
On this chart we see that the series for each product are well colored and well structured for each cart.
Now, let's jump on my problem: the data structure.
In my world, data is coming from a database, so the data are structured like that:
I managed to aggregate the values but I loose colors of my series and I need absolutely to identify visually the different product volumes.
Is there any possiblity to reach the first stacked chart layout but with the second dataset format ?
Yes, transfer your data and chart from there (I don't think there's a native solution for this, but happy to learn otherwise).
For example, use =QUERY([data],"select [cart], sum([qty]) group by [cart] pivot [product] label sum([qty]) ''",1) replacing the terms in the brackets with the respective column letters (e.g. B if cart is in column B).
I have two questions.
1) I would like to reduce the number of observations in "location" from 5 to 1 for every country and get the corresponding values for the years in just one row. How do I do this?
Screenshot of dataset
2) I would like to merge this dataset with another one, where "location" is not defined by country code, but country name. How can I merge them?
Thanks!
collapse (min) YR*, by(location)
There is no straightforward way to do this. You need to make sure that both datasets contain a variable with the same values to merge on, so either 3-letter country codes or country names. You can try to find a dataset that contains both and merge it with one of your datasets. Another option is the user-written kountry which is made for these kinds of things. If you type search kountry in Stata, the first result will be package dm0038_1. If you click on it there will be a link to click on to install it.
My query is not returning the literal cell value, but rather only the visual portion of it.
I've got a google spreadsheet with FirstSheet having my info and then with the use of a query on SecondSheet showing part of the information.
The first column of FirstSheet has a hyperlink for each row in column A such as:
=hyperlink("http://www.google.com/test","My Test")
SecondSheet has a query that pulls that column amongst others such as:
=query('FirstSheet'!A2:C;"select*",0)
The query result only returns the label of the hyperlink but not the link itself or the hyperlink formula. Meaning I see the same text on both sheets but on SecondSheet it's not a link. I hope this makes sense.
I've thought about different ways to accomplish this including some how creating a string from a query to give me what I want, but I'm not sure. Any help would be greatly appreciated.
I solved it by moving the query to B2, selected column A last, putting it into Col C, hid C. I'm then using C with a formula I created in col A and then just pasted that formula down to row 100.
=If (C2="","",hyperlink("http://www.google.com/"&C2,C2))
I would have liked this to be more elegant, but it's good enough for now.