I would like help with a problem, or rather a challenge in Excel and/or Google Sheets.
What we want to develop is as follows:
We have a table of products and certain attributes. Now we want to create a kind of search function based on this table.
Example:
Let me give a simple example. Suppose you have as a product an apple, a banana and an orange. The characteristics associated with these are size, color country of origin. We then want a search function, where you indicate one or more preferences, i.e. size, color and/or country of origin and that based on those criteria, all products that meet these criteria are displayed.
So if you specify oblong as the size and do not specify any other criteria, it only shows "Banana. If the banana and the orange have Holland as their country of origin and you only give Holland as the criteria country of origin, it will show 'Banana' and 'Orange'. If you say country of origin Netherlands and format oblong, it again shows only 'Banana'
See below an image of our document and how we would like this to look approximately.
Currently, there is no existing formula, because we simply do not know if this can be done and how best to do it.
The document can be accessed at:
A copy of our document with sample data:
Document
ADDITION:
Hi, Unfortunately I still am not able to get it to work. I am not really a hero in coding/functions. I created a bit more of a clear view in my file and also set the language of my sample file to english. You can find it here: Sample
What I actually need is just that it shows the data on 'Datasheet' if conditions on the left (parameters/value) are met, but only if they are filled. Probably easy one for you, hard to me haha Could you help me out once more? –
Your question is very generic, I will try provide here some guidelines on how to achieve it in Excel or Google Sheet based on my own experience. The approach used for Excel can be used for Google Spreadsheet, since it is based on FILTER function that both tools have but with different signature. For Google Spreadsheet you can also use QUERY that is very powerful for situation like this.
In all cases, it is a good practice to have a sheet with the input raw data (let's say Input tab), then in second sheet the working data of filtered data (let's say WorkData). This is specially relevant when the raw data is big dataset, so you don't touch the original data set, and instead you have the filtered data in a separated tab.
Both tools offer filter features in the UI or slice. This is something to consider, but using Excel/Google Spreadsheet functions, you can show the filter parameters in a more friendly manner, because you can see the parameters selected without additional click to find what filter values where selected. The approach here is based on Excel/Google Spreadsheet functions.
Excel
Let's say you have a block of filter conditions that you want to apply to a range of data. You can use data validation list so you can select a subset of possible values for each of the filter conditions and then to concatenate such conditions logically (OR or AND) using multiplication of addition.
=FILTER(dataset, condition1 * condition2...conditionN)
where each condition is based on the filter value you want to restrict and each condition represents an array of {TRUE,FALSE} values all of them of the same size as dataset (number of rows).
I use some wildcard values to represent all values of the column, in my case I use ALL, but you can setup in a different way. In such case the filter doesn't take effect, but we want to make it work when a specific value is selected. The following trick can be used for both scenarios.
IF(B3="ALL", D3:D15<>"*",D3:D15=B3)
indicating that if B3 is equal to ALL, then the condition to select all of the D3:D15 rows is the following: <>"*". Otherwise select only the rows equals to B3.
Sometimes I would like to consider OR conditions for a given filter condition, for example for a given filter condition, consider value1 or value2 and it is represented in the filter value as a list of values delimited by comma, for example: value1, value2.
Here, some Stack Overflow questions I posted with answers about how to deal with that:
Filter an excel range based on multiple dynamic filter conditions
Filter an excel range based on multiple dynamic filter conditions (with column values delimited)
Google Spreadsheet
The FILTER function here, allows to add the filter conditions via input arguments, so now we have:
=FILTER(dataset, condition1, condition2...,conditionN)
Note: Keep in mind in Google Spreadsheet we don't need to add the conditions by multiplying each one of them. It is added via input argument.
here you can check some of question I posted related to this topic:
Using ARRAYFORMULA with SUMIF for multiple conditions combined with a wildcard to select all values for a given condition
Using ARRAYFORMULA with SUMIF for multiple conditions combined with conditions using a wildcard. Result by Months
In some cases it is better to use QUERY function.
Here, a sample file using QUERY statement and how to combine multiple conditions inserting IF in the where statement.
sample query on C1 cell:
=query('Jira Issues'!$A:$T, "where "
& IF(B2="", "G is not Null", "G >= date '"
& TEXT(startPeriod,"yyyy-mm-dd")&"'")
& IF(B3="", "", " and G <= date '"
& TEXT(endPeriod,"yyyy-mm-dd")&"'")
& IF(OR(B4="ALL",B4=""), "", " and A='"&B4&"'")
& IF(OR(B5="ALL",B5=""), "", " and I='"&B5&"'")
& " label A 'Team', S 'Reporter', T 'Assignee',
P 'Env.', I 'Release'",1)
The raw data is in Jira Issues tab, the data populated is based on multiple filter conditions. I am using some name ranges for the filter values for a better understanding of the formula, such as: startPeriod, endPeriod, etc. You can test the actual query will be invoked looking at the result of the consolidated string of the query input argument of QUERY function.
Similarly you can stablish a where statement to consider whether the input parameter is empty or not. In such case, you can build a logic like this inserting an IF block as part of the where statement and concatenate the string result.
=QUERY(Input!A:Y,
"select *" & " where A " & IF(B2="", "<>'*'", "='"&B2&"'")
"and " & " where B " & IF(B3="", "<>'*'", "='"&B3&"'")
,1)
The above query for column A or B, returns the entire column via condition: "<>'*'" if the input parameter B2 or B3 were not specified. In a similar way you can add additional conditions for more parameters, repeating the third line of the query and changing the column and the parameter cell.
Recommendations
Focus on a specific tool: Excel or Google Spreadsheet, even they have some similarities, you need to get familiar with the specifics of each one of them.
Try to start working on your specific problem, once you face impediments, do some research, usually you are not the first person facing this problem, if you don't find a solution, then post your specific problem using a sample as an extract of your real problem (in English, your sample is in other language). Generic questions like this one are difficult to get some attention.
I am building a solar-system. Artifexian (a youtuber) has created a google sheet that calculates all the necessary values I would need to start mapping the system. I want to get the albedo value from each of the planets I create and put all of them in a single table. All the calculations for a specific body are on a sheet named after it's name.
The reference i have is: ='PLANET Sphe'!C20 I can change the "PLANET Sphe" part manually but the work involved starts to add up when I start creating hundreds of moons and kuiper belt objects. And will also need tables for the semi-major axis and the radius.
Is there a way for me to write the planet names in one column. Then in the next column over have the reference pull the sheet name from the text in the first?
https://docs.google.com/spreadsheets/d/1MwRBNKf0ux40sL2Cr8KxUzZXbxdgW0r9KZQPqbjZNbo/edit?usp=sharing
I am talking about the rightmost sheet named "APPARENT SIZE & BRIGHTNESS" in cell D37.
The following formula worked for me.
=INDIRECT("'PLANET "&B37&"'!C20")
It is concatenated from 3 parts
"PLANET "
This is the first part and is added as a string. It is the first part of the Sheet name and the same for all planets made.
&B37&
This concatenates the string of part one to whatever is written in cell B37. And it concatenates it with the 2nd & to part three.
'!C20
Also put in as a string. The '! finishes the reference to which sheet is to be looked at. Then cell C20 on that sheet contains the displayed output.
the computer resolves it as follows:
=INDIRECT("'PLANET "&B37&"'!C20")
=INDIRECT("'PLANET "&Whesm&"'!C20")
=INDIRECT('PLANET Whesm'!C20)
='PLANET Whesm'!C20 output cell C20 located on sheet 'PLANET Whesm'
This has stumped me..
example sheet
I'm looking for a conditional formula that will flag/recolor names if multiple names are used from a select column "database" in a sort of "roster" or schedule format.
You will see on sheet 2 that there are lists of names in columns. In sheet 1, there are "groups" of names. I want it to recolor the names if multiple people from the same column on sheet 2 are in the same "group" on sheet 1. It should only recolor them if 2+ names from the same column are in the same group. 1 name from a column is fine.
The use case is so if I schedule groups of individuals that overlap certain skill sets, I can notice that I've sort of double booked people who share a similar skill set and can better be used in a group where that area is lacking.
I use a formula to match a name 1 to 1, but I haven't figured out a way to modify it for this specific case (taken from the actual sheet). This is also limited by being used in a range of a singular column, so this has to be applied to every single column with different ranges. Tried different versions of an arrayformula I found in other posts but obviously so far have been unsuccessful.
=match(I42,indirect("staff!N10:N32"),0)
Check this sheet
Use =iferror(mod(match(A8,flatten(Sheet2!$A$3:$E$5),0),COLUMNS(Sheet2!A3:E5))) in determine the group in which every name belongs to. You can hide this helper cells
Use the following conditional formula: =countif($C$4:$D$8,C4)>1 to count the number of people that share a similar skill, and colorize the cell if there is more than one from the same skill group
I am creating a tool for a video game I play.
Link to the example spreadsheet (Please make a copy to edit so that this copy stays intact for additional helpers).
Sheet 1 is “Choose Owned”. It contains a list of all of the champions available in the game and includes their attributes.
Column A contains checkboxes. Checking a checkbox indicates that the user owns that champion, and brings it to Sheet 2.
Sheet 2 is called “Owned”. It contains a list of the champions checked off in “Choose Owned” (aka the champions the user owns). “Owned” includes the champion attributes too, as first seen in “Choose Owned”.
Beyond those same attributes, “Owned” contains 8 additional columns.
These columns are from Columns G:N and are labeled ‘Level’, ‘Rank’,
‘Ascension Lvl’, and ‘Team Label(s)’ (‘Team Label(s)’ takes up
columns J:N). This data is all unique information and requires the
user to input the information themselves depending on their
champions.
Because there are so many champions, I want the user to be able to use the Filter function in “Owned” so they can easily locate the champion they need or sort the table however they wish.
However, because I use the QUERY function to get the data from “Choose Owned”, the Filter function tends to break. The most obvious error comes when you try to sort A-Z or Z-A; this simply cannot be done. I was fine with this, and have even included a note at the top telling the user to avoid sorting alphabetically.
Everything else works correctly until the user tries to add a new champion from “Choose Owned”. When the champion is added to “Owned”, the additional, unique data in columns G:N go out of order because they don’t move with their original champions.
Example:
I choose my champions. These champions are copied to “Owned”.
I pick their relative data in columns G:N.
A few days later, I obtain new champions and check them off in “Choose Owned” so they are added to “Owned”. However, when I do this, the champions stay in the same order as they are in “Choose Owned”, and columns G:N do not move with their champions so now, that information is with the wrong champion.
I want the additional data (G:N) to move with their champions when the table is edited due to champions being added. Or, in other words, I want those columns to stay linked to the first columns.
If there is a different way to achieve all of this like if I have to use a function other than QUERY, that is fine!
Please share any solutions you may have. I would prefer to not use a script but will consider the idea if it works.
this is a common issue within Google Sheets and it's solvable in 2 ways:
either by introducing a common value (unique ID) and then linking the manual input to query and aligning it by ID
or easier approach in your case - using timestamp/linear ID so every new entry would be added to the bottom and then the query would be sorted based on this order.
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