Dropdown lists & conditional formatting in Google Sheets - 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.

Related

I would like to Automatically sort a Google Sheet highest to lowest, then remove duplicate values

I have a google sheet that contains an inventory list that include manufacturer and model id's. Each line item contains a price and the amount the product is discounted below MSRP. I have the raw information dumping into a spreadsheet daily but I need the sheet to automatically sort the sheet by the make/model/highest discount value and then remove the duplicates (Removing all of the lower make/model/discount values). I could easily do this task manually but I am hoping to find a scaleable way to perform this tasks for many different lists.
To get UNIQUE Id's paste this formula in F2.
=UNIQUE(A2:A)
In G2 Paste this formula and drag down.
=IF(F2="",,SORTN(FILTER($B$2:$D,$A$2:$A=F2),1,,4,0,3,0))
Note: duplicates are highlighted in yellow and green

Total Value based on Group cross reference? (Google Sheets)

I'd like to query a couple of tables to come up with a total sum of the value of a set of items, but with the price being dependent on data in another cell range, then grouping it based on category.
For example, say I have a data table containing name, category, and price of some grocery items. Another table I store my current inventory of groceries. I would like to calculate the value of, say, all my fruit.
Here is an editable example:
https://docs.google.com/spreadsheets/d/1y2fLgwrsMr-dWojy3uYZ1Qs2U01AP3RlT_PI2txwZRE/edit?usp=sharing
Not sure the best way to approach this?
Thanks for any guidance!
Solution
Use VLOOKUP for searching the right item of your inventory and then multiply it with the value of the product you made the search with. For more info about VLOOKUP check this documentation.
=VLOOKUP(E3,$A$3:$C$11,3,FALSE)*F3
With these values, create a column next to Quantity indicating the total price for each product (as show in the picture below). Then, create another column with the Type of each item performing a similar VLOOKUP formula:
=VLOOKUP(E3,$A$3:$C$11,2,FALSE)
Finally, use these two columns as input ranges to apply a SUMIF formula for adding up the items of each group:
=SUMIF(H3:H6,"Fruit",G3:G6)
For more info about SUMIF check this documentation.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Conditional formatting - cells in a range that having matching values from another range

I'm in a few Discord servers that let users hold auctions of in-game items to be exchanged for an unofficial in-game currency. Since some users will bid but fail to follow through on the trade, I have a way of marking that user (for my own personal records) as a bad trader. What I'm trying to do is set up conditional formatting on the row of the auction information to highlight in a red color if the ID of the user (long ID not their tag) matches someone on that list. I have conditional formatting set up to highlight the rows for other reasons and those work great.
Using an arrayFormula() in column L, I've included this code:
LOOKUP(D2:D,Discord!F2:F)
It lists either N/A or the Discord ID number of the user if there's a match. I then hide that column and have the conditional formatting formula as "=$D2:$D=$L2:$L" to find matches.
What I would like to do is to accomplish the same result but without using a dedicated column to do it. Simply put, conditional formatting that will return true when a value from one row in the range matches a value from any row in another range.
You can try this custom formula:
=countif(INDIRECT("Discord!$F2:$F"),$D1)>0
See it working in this example sheet:
https://docs.google.com/spreadsheets/d/1izTh57D58QiG_SOx-IyQW5SLwtAb0FqvDopeArgRnog/edit?usp=sharing

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

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.

SUMIFS function across multiple sheets

For reference, please visit this Google Doc which is a simplified example of my problem, which is to determine total sales in Blue and Green markets each month.
Each month, I receive a new sales report from accounting for all of our markets and I add the sheet to the main workbook. My team is in charge of assigning "colors" to the markets and tracking this. As it's privileged information, we can't have accounting auto-tag these in the data they send over.
One solution would be, for each new monthly report that comes in, tag each city with the color. However, we have hundreds of markets and this isn't very practical to go through each time.
I assume that a SUMIFS function would work here, but am unsure how to set it up when there are values spread across multiple sheets.
You can use this function in B8 of February tab:
=SUM(IF(COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0,$B$2:$B$5,0))
COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0 gets an array of the countries that belong to the colour specified in A8 of the current tab (Would that be possible to put only Green and remove February Sales from that cell?).
If the country belongs to the particular colour, then return the array of corresponding values in column $B$2:$B$5.
Lastly, sum this array.
Note:
You need to array enter this formula in Excel (by holding Ctrl+Shift then hit Enter after typing in the formula).
In Google Spreadsheets, you array enter a formula by wrapping the formula around =ArrayFormula(), meaning you use:
=ArrayFormula(SUM(IF(COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0,$B$2:$B$5,0)))
In Excel you can use this "array formula"
=SUM(SUMIF(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),B$2:B$5))
confirmed with CTRL+SHIFT+ENTER
The same formula works in google docs if wrapped in arrayformula, i.e.
=arrayformula(SUM(SUMIF(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),B$2:B$5)))
or you can use FILTER as user3465711 suggests, i.e.
=SUM(filter(B$2:B$5,isnumber(match(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),0))))

Resources