I’d like to create a dynamic search box at the top of my master sheet (Sheet 1) instead of using the “Find” command, Ctrl + F. It would search column B and output info from the corresponding cell in column C.
The search box/cell would be dynamic, so as I type into it, it would pre-populate from a master list (Sheet 2), without having to hit ENTER or an OK button.
I’d like the search box/cell to be in A1
I’d like it to search column B data. From B2 to the end (row can change): B2:B
The result would be the data in column C:C2:C
Not sure if I should use the QUERY or ARRAYFORMULA function. Appreciate any thoughts on how to set this up.
how about this:
=JOIN(CHAR(10), QUERY({B2:C}, "select Col2 where Col1 contains '"&A1&"'", 0))
demo spreadsheet
I think I figured it out!
Sample Sheet
Search Box (A1): I used Data Validation. It is dynamic as I type and lists the master list of items in column A
Search Results (B1): I used VLOOKUP
Thanks, #player0, for suggesting the data validation! Really helped :)
Only issue is that I sometimes have multiple values in Column B (Item). For instance, I have "lemon" listed twice. I'd like the output in B1to show all other results. They can show in B2...Any suggestions?
EDIT: For the issue of multiples in column B, I decided to change all items in Column B to a unique identifier.
paste this in C2 cell:
=QUERY({B2:B}, "where Col1 contains '"&A1&"'", 0)
and set up dropdown data validation from B2:B range in A1 cell
demo spreadsheet
Related
There are a lot of questions on how to multiply all values by some other cell or to move all values to another cell based on some value, but what I want is to take, in the example image below:
All the values that I have selected and divide by 2. I do not want another column, I just want to change all those values in the spread sheet and divide them by 2, the values themselves should change.
I have not found an answer for this any where and I sure it is super simple. For example, in:
base_damage_mod selected column, 0.03 would become: 0.015.
The only way I know to do this is manually, and that's a lot of work ...
Whats the easiest way to do this?
The easiest way to do this is by writing a macro, like in the following example:
Sub Divide_by_2()
For Each c In Selection:
If c <> "" Then
c.Value = c.Value / 2
End If
Next c
End Sub
In order to launch this, you need to select your cells (no need to copy, or press Ctrl+C), and then launch the macro.
As far as the source code is concerned, this is pretty obvious, except for the c <> "" part: I have added this in order to avoid the value 0 being filled in in empty cells.
Is there a way to do this without VBA, without macros?
Yes, there is, but it involves you creating a new column, in there type a formula, then copy the values of that formula into again another column and remove the first two columns, in other words: it's quite Messi :-)
If column C is empty (if not, temporarily insert a column), enter a 2 there next to every used column D item (*).
Copy all of column C, and "Paste Special" onto column D using Operation>Divide.
(*) If there are too many items to manually do the "2", copy this formula down column C =IF(ISBLANK(D1),"",2) and it will add them. After this, convert column C from formulas to values by copying it and using "Paste Values" to paste it back. (Special Operations won't work on formulas)
I am trying to create a pricing spreadsheet for the company I work for.
I am looking for a formula that returns a value from a specific cell based on text in two other cells.
An example is:
Sheet1:A1="Clear", Sheet1:B1="Black"
Sheet2:A1="Opacity", A2="Clear", A3="Yellow"
Sheet2:B1="Color", B2="Brown", B3="Black"
Sheet2:C1="Price", C2:1, C3:4
Return
IF Sheet1:A1="Clear" AND Sheet1:B1="Black", RETURN specific value from Sheet2:C column
Any tips or references I can look at to get this figured out?
I think below will help you to reach to the desired answer.
Add a new A column in sheet 2 (Later you can hide this)
sheet2:A1 -> =CONCATENATE(B2,",",C2) Drag to the End of the table.
sheet1:D1 -> =CONCATENATE(A1,",",B1) (Later you can hide this)
sheet1:C1 -> =VLOOKUP(D1,Sheet2!$A:$D,4,0) (What you expected)
Have you tried simple vlookup with the values ? Something like:
Vlookup ((sheet1$colA & sheet1colB), sheet2$colC, 1,0)
Try this. Will test for more and update.
I have a list and I want to display certain data based on another cell value. Let's call it "cell A1".
In my logic, every value of "cell A1" means different list items.
The problem is when I added other values to the possible data that "cell A1" could contain, the formula becomes very long and couldn't fit in the source field!
For example, if "cell A1" possible values are Tigre, Dog, Cat, Lion, Horse, Sheep and Turkey, the condition is:
=IF(D4="Tigre";'Sheet1'!$B$2:$B$1000;IF(D4="Dog";'Sheet2'!$B$2:$B$1000;IF(D4="Cat";'Sheet3'!$B$2:$B$1000;IF(D4="Lion";'Sheet4'!$B$2:$B$1000; IF(D4=" Horse";'Sheet5'!$B$2:$B$1000;IF(D4="Sheep";'Sheet6'!$B$2:$B$1000;IF(D4=" Turkey";'Sheet7'!$B$2:$B$1000;IF(D4="Val8";'Sheet8'!$B$2:$B$1000;""))))))))))
Check this image, the source field is already full! (before the end of the condition)
have you an idea how work around this issue or how to optimise the conditional formula?
PS: I'm a french user, so I apologize of my bad english! And, I know that I need to use "SI" instead of "IF" :)
Thanks.
I think you may be after something called dependent data validation.
Look here for a step by step tutorial http://www.contextures.com/xlDataVal02.html
As I see from your example, Val1 Val2 etc. are keys to redirect to specific worksheets. You can write the "mapping" data betweens these "Vals" and sheet names somewhere (possibly in a hidden worksheet or any available/hidden columns) and use it in the validation formula using a combination of INDIRECT and VLOOKUP. Say in this example I use Columns G:H in worksheet "mapping":
' Worksheet mapping
G H
Val 1 Sheet number 1
Value 2 Sheet2
Val3 My worksheet number 3
Now your data validation formula can be like this:
=INDIRECT("'"&VLOOKUP($D$4,mapping!$G$1:$H$3,2,0) &"'!$B2:$B1000")
p.s. you can then make the column mapping!G1:G3 your data validation list for the cell $D$4 that holds the keys.
I also notice here that if the ranges are not always the same (unlike in your example where they all are B2:B1000), you can also make the mapping "complete" by including the ranges in the redirection column (column H in my example).
My requirement is very simple but i am not finding it easy-
In excel, column A is having 'Table name' and column B is having 'Column name'
I want to write a query-
Select * from 'column A' where 'column B' is not null.
In excel I have 2578 lines so I dont want to write 2578 Select statements.
any expert help in Excel?
I doubt this is your answer, but may help towards what you want. Based on #user3514930's approach:
With data as in the top left corner, select the two columns and click on DATA > Sort & Filter - Filter. Click on the arrow in the Column name cell and on (Blanks) in the dropdown. You should then see the equivalent of what is in the lower range. This can be copied and pasted elsewhere in the sheet, if you wish.
Note: My question is similar Googe Spreadsheets' ImportRange function.
Is it possible in Google Spreadsheets or Microsoft Excel to import data based on cell values?
For example, can I copy contents of Sheet1 to another sheet where column B == "foo"?
Target (Sheet1):
The destination sheet should only copy Row 2 and 4 since those are the only ones containing "foo"
Edit:
For Google Docs, I am looking to something like this:
=ImportRange("spreadsheetkey", QUERY('sheetname'!A6:E10, "SELECT A, B = 'foo'")) however I can't get it to work.
You can do this just how you said but instead of using a Query in the ImportRange, you use the ImportRange in the Query, so:
=QUERY((ImportRange("spreadsheetkey", "sheetname!A6:E10")), "Select columnnumbers like Col1,Col2 etc Where _Criteria for select, such as (B contains 'foo') order by which column if you want to")
you could do something like this:
first, in an extra column (for example, column D) identify the rows / cells to be copied:
range("D" & range("A" & activesheet.rows.count).end(xlup).row).formula= "=IF(B:B=""foo"", NA(),"""")
next, use SpecialCells to select the cells in Column A, and B where Column D shows NA#
range("D1:D6").specialcells(xlcelltypeformulas, xlerrors).offset(0,-2).copy
othersheet.range("A1").pastespecial xlpasteall
that should get you started with some code to play with
of course, you can also do it without VBA, just paste the formula in, the use F5, SpecialCells dialog...
You need to wrap the query with the importrange inside of it like this:
=QUERY(importrange("spreadsheet key","sheetname!A6:E10"), "SELECT A where B='foo'")
You can do it with FILTER function:
=FILTER(IMPORTRANGE("spreadsheet_url", "'sheet_name'!A6:E10"),
IMPORTRANGE("spreadsheet_url", "'sheet_name'!B6:B10")="foo")