I have three columns like so:
Column 1 is a numeric identifier essentially just the row number
Column 2 is a country name
Column 3 is a comma separate string of country ids, may be blank (represents a relation between the country for that row and the other countries in the comma separated list).
What I want is to put a comma separated list of countries in column 4 which is more readable than the ids. Pretty much a code table look up but complicated because it is not a single value in the cell but a collection of values. I don't own the table so I can't change the way the data is coming to me from the source - I can do whatever I want with it once I get it though :)
I could also live with breaking out the comma separate values into separate columns, so long as the new columns contain the country names and not the ids.
As requested here is a link:
https://docs.google.com/spreadsheets/d/1LY_8xh992pjZnoNSP-7P5x2iD1VVFozy8stlH4DLqNQ/edit?usp=sharing
You can use following formula:
=TEXTJOIN(",",TRUE,FILTER($B$2:$B,SEARCH(","&$A$2:$A&",",","&C2&",")))
Related
In this scenario, I have a reference column (A) of 6 types of devices, and a second column (B) of several thousand specific device names including the word from the reference column in the string.
I am trying to extract into a new column (C), from the column B just the relevant word from the string that corresponds to the reference column.
So far have been unsuccessful in finding the right working formula.
You can use VLOOKUP function to search particular data and get desired result.
So I'm making a dependent dropdown column in Google Sheets that has a bunch of different things of a type. I've named the ranges I want to use and I've got column A with those names in the dropdown. The problem is, I can't use the contents of column A to reference in column B's data verification.
E.g. I select Tech in column A, column B reads that as "Tech" when I want it to be able to reference the named range Tech. How to you convert from the string "Tech" to the named range Tech? Is there a way without using a stupidly long nested IF on every single row of B column's data verification?
Thanks in advance :)
I need to get unique values from two columns into a single one.
I tried with formula unique(A:B) but this formula creates two columns for the results. I need the results to be in a single column. Take a look at my capture:
You could try (in D3):
=unique({A3:A;B3:B})
The braces with the semicolon create a stacked column of A and B.
To avoid blanks, you could try:
=filter(unique({A3:A;B3:B}), unique({A3:A;B3:B})>"")
I have a spreadsheet having a column of names. Now, in another sheet I want to have the surnames from the aforementioned column to be displayed in a dropdown. How can I do this?
The names look like this:
Surname, FirstName
And there are also people from the same household having the same surnames. There are no people with the same surname that belong to different households. So I kind of want to get the surnames to identify that household.
You can create a single array formula referencing that list of names, that only pulls the surname portion using regexextract like this:
=IFERROR(UNIQUE(ARRAYFORMULA(REGEXEXTRACT(A:A,"^(.*),"))))
To explain, the regexextract, I feel is a lighter formula and slightly simpler than using a split function for two reasons:
A split function would require you put both names to two separate cells, and unfortunately split function does not work with arrayformula.
But since regex does - the regex I specified is basically saying grab any text (.*) from the beginning of the cell ^ up until that comma ,.
I then wrap the whole function in unique, so you dont have to deal with a ton of duplicates in your dropdown.
Following that I used Data Validation to point to the range of these unique surnames.
And just for fun at the end I finalized it with a FILTER function that would populate all the corresponding cells based on the surname chosen from the dropdown using this formula:
=FILTER(A:A,REGEXMATCH(A:A,C1)=TRUE)
To wrap all this information up, here is a sample image of what it looks like in the end:
I guess you have to split the names into another column. Let's say your names column is in A1, set the following formula in B1 and copy it in the next cells of the B row :
=SPLIT(A1;",")
Then, you can define your dropdown list in another sheet as explained here : https://support.google.com/docs/answer/186103
I've searched all over and this simple principle is apparently not so simple.
BTW I'm using Google Sheets which as you probably know has most of the same functionality as Excel, plus an extra function that might be useful in my case: COUNTUNIQUE()
My "Criteria" is two-fold and required for two different expressions:
Count the unique values that "contain" a string.
Count the unique values that "don't contain" a string.
Consider this data:
A
1 snapple
2 snapple
3 grapple
4 orange
5 orange
6 peach
Criteria 1: Say I want to count the unique values in Column A that contain the word "apple."
In the data above, it should render "2," knowing it should void duplicates.
Criteria 2: Say I want to count the unique values in Column A that don't contain the word "apple."
In the data above, it should render "2," knowing it should void duplicates.
Here's a sheet doc to test: https://docs.google.com/spreadsheets/d/1JYZIhZmSuoWoGvmTFFcBAD1EUQVWvosqBQzkGsbwaOI/edit?usp=sharing
Criteria 1:
=COUNTUNIQUE(IFERROR(QUERY(A:A,"select A where A contains 'apple'",0)))
Criteria 2:
=COUNTUNIQUE(IFERROR(QUERY(A:A,"select A where not(A contains 'apple')",0)))
Original answer:
Criteria 1:
=COUNTUNIQUE(IFERROR(FILTER(A:A,SEARCH("apple",A:A))))
Criteria 2:
=COUNTUNIQUE(IFERROR(FILTER(A:A,ISERROR(SEARCH("apple",A:A)))))
This gives unpredictable results when referencing cells with clickable URLs in. IMO, this is a bug associated specifically with the FILTER function, and how it parses URLs. QUERY works around this because (again, IMO) it will first convert the source data to a single data type (in this case text) in each referenced column.