how to get unique values with excluding particular value in google sheet - google-sheets

I could able to get unique values from one sheet. but need to exclude few values while getting them from another sheet.
For example, Ive got below details from one sheet by using =UNIQUE(Country!A1:A223). Now I need to exclude only India from this list . I tried with =UNIQUE(filter(Country!A1:A223="India") Which is not working.
India
China
US
UK
Australia
Singapore
How to exclude particular data from this list.

To exclude India use:
=UNIQUE(filter(Country!A1:A223,Country!A1:A223<>"India"))
If you want to exclude a list of countries you can create a sheet named Country (the list of countries including duplicates), a sheet named Exempt (a list of countries to exempt from the Country sheet) and then enter this formula where you want the new country list to appear (this can be a new sheet. The formula assumes row one on the Country and Exempt sheets is a header row.
=unique(filter(Country!A2:A, isna(match(Country!A2:A, Exempt!A2:A, 0))))

Thanks for your input. It really helps me. I've another concern now. =vlookup(C5,'Country'!$A1:$B20,2,false).
From the above macro, I need to increase the value only for C and A,B values should be same If I drop down this for another 100 fields.

Related

Imported data into Google Sheets, match and change one Column of Data

I have a google sheet that users input data on. These sheet has complete town names. Eventually the data they input gets uploaded into a program which has the town names abbreviated. Im looking for a way to automate basically doing find and replace.
Sheet1- Users input
Town
Data
Washington Town Center
123345
Washington Town Center
988765
Fairland Heights
12345
Sheet2 - Reference to the correct names for program.
User
Program
Washington Town Center
Washington Twn Ctr
Fairland Heights
Fair Heights
I basically need to replace the Town names in Sheet1 with the names the Program uses and then all data with that row. A new sheet worth of data is sent every week, so Im looking for the most efficient way to change those names.
I have tried using QUERY and FILTER but cannot seem to find the best way to go about this.QUERY would find all the matches and add as multiple rows as the user sheets can have multiple entries for same town
=QUERY('Sheet1'!A:G,"select * where A like '%"&A2&"%'",0)
you need VLOOKUP:
={INDEX(IFNA(VLOOKUP(Sheet1!A:A, Sheet2!A:B, 2, ))), Sheet1!B:G}

Dropdown lists & conditional formatting in Google Sheets

I am making my business spreadsheet and my business is selling in multiple countries. So, for example, I have a drop-down list (and when Country is chosen I want it to affect the rest of the spreadsheet). In that list, I have all the countries I sell to. What I want to do is for example when I select UK it will update all the prices and costs that are there to GBP AND also hide specific columns that are not necessary for the UK. The same goes for other countries if US is selected I want to see $ currency and hide the column of VAT tax since it doesn't apply to the US.
To summarize, when Country is selected from the dropdown I want it to show different values and hide 1-2 columns. Wondering if this is even possible in sheets. Hopefully, this makes a little bit of sense. Thanks for the help!
Yes It is possible, get only the columns you want from a range.
Dropdown from a list
Go to Data > Data validation Criteria: List from range and Enter a range or formula.
The Formula
Paste this formula next to srearch key range and below the column names you want to search, Take a look at this "freshly made" Example Sheet.
=ArrayFormula(IF($B$2:$B="",,VLOOKUP($B$2:$B,$G$3:$J$16,MATCH(C$1,$G$2:$J$2,0),1)))
Choose the country and all the data will be populated, replacate this formula column and expand the lookup range to get more info put in place.
we are using MATCH to return the matching index from the column above for example Currency C1 from the range G2:J2 which is 2 in this case MATCH function returns the matching value index "column" 2, to be used as an index for vlookup function.

I need to have a running count of submitted zip codes for multiple regions in google sheets

I need to have a tally of zip codes per city. EX: San Francisco (4)
and as more zipcodes are submitted to add to that tally. I have tried COUNTIF and COUNTIFS but I am checking against 50+ criterion as each greater Metropolitan area has many different zip codes. I have a list of all the zip codes needed for the tally.
I need a to have a running count in B2 if any numbers in column D are already in column A or are appended to column A in the future. And the same for Column E.
Hopefully this formula can help you out. It is not clear if you have a working column of cities associated with zip codes but if you do you could use something like this:
What this formula is doing is looking up the city in column B from the zip code list in column D, it is than tallying how many times that zip code appears in column A and setting it in parenthesis.
*Note that none of those cities are accurate to the zip codes used. Do not pay close attention to the city names in column B as they do not coordinate at all with the zipcode. I just wanted to show how to implement the city.
FORMULA
=IFERROR(ARRAYFORMULA(VLOOKUP($D2:$D,$A$2:$B,2,FALSE)&" ("&COUNTIF(VALUE($A2:$A),VALUE($D$2:$D))&")"),"")
UPDATE:
Is this what you're looking for? It tallies up the total number of times a zip code from a corresponding column shows up, you can drag this formula over for as many cities as you want, if it is actually laid out in the way your image shows.
=SUM(ARRAYFORMULA(IF(D$2:D<>"",COUNTIF(VALUE($A2:$A),VALUE(D$2:D)),0)))

LOOKUP with dropdown list doesn't work for some keys

(I apologize if this was answered somewhere else so if it was please share with me because I couldn't find anything)
I have two sheets, one with a long two-column list - first column: city, second column: office
I can't give away the details due to my job's privacy concerns but it is just to group certain cities with certain "offices" and I figured the easiest way to do this would just simply type the office name next to the city all the way down so I could use =lookup()
I have a dropdown list that references the range of cities on the next sheet (so all values match exactly as it is) and the cell next to it will populate the office name associated in the next column to the city name.
=LOOKUP(B2, Sheet2!A2:A, Sheet2!B2:B)
B2 being the cell with the dropdown list, Sheet2!A2:A being the list of cities and Sheet2!B2:B being the list of offices
There are no duplicates in the city list, I have removed them. Though currently, there is only one office type I have included on this sheet for now until I get this working.
Some dropdown items display the office name just fine, others (just random ones) display an error. I don't really understand since they're all in the same place.
I made a copy and moved it to my personal drive so you can look at it directly
https://docs.google.com/spreadsheets/d/1TF1bBQdC8ysA30YcGOmB1ojrvQGnfGrznWOrA1vzHZs/edit?usp=sharing
Thank you for any advice, I'm probably missing something simple or there is a better way to do this.
*update: there was really no point in editing this post but thanks?
use VLOOKUP instead of LOOKUP
=VLOOKUP(B2, Sheet2!A2:B, 2, 0)
if you have more cities you can use arrayformula:
=ARRAYFORMULA(IFERROR(VLOOKUP(B2:B, Sheet2!A2:B, 2, 0)))
Your lookup is not working because the search range is not sorted.
The documentation for LOOKUP has a note:
The LOOKUP function will only work properly if data in search_range or
search_result_array is sorted. Use VLOOKUP, HLOOKUP, or other related
functions if data is not sorted.
You can sort the cities in "Sheet 2", or you can use VLOOKUP instead since it supports unsorted ranges:
=VLOOKUP(B2, Sheet2!A:B, 2, FALSE)

Advance Excel Compare Function

I have an excel sheet which shows the names of 1,900 borrowers. The sheet is not sorted out in alphabetical order (and it does not need to be sorted in alphabetical order). What I am trying to perform is that I want to compare the two column and see if they match. If the two columns do not match I want that result to be shown either in separate column or those names of the countries and responsible person to be highlighted.
For example, the below screen shot shows that there are various countries in the list and there is various responsible person associated with each country. The idea is to identify the countries whose responsible person are not the same. So in this example countries USA & AUSTRALIA should not show up because they have the same responsible person but all other countries and responsible person should be identified. I appreciate and thanks for all the help.
You can solve this by creating a pivot table of your data. Insert pivot table and then add Country name and count of responsible person as grouping (assuming no duplicates) then anything with a count greater than 2 is an issue.

Resources