How can I search across Excel sheets? - excel

I want to transfer data automatically from 2 sheets to one single combining one. That means I have 2 different export sheets (called 'Te_open' and 'Te_closed') that contain both the columns "Problem" (in different positions, can vary always). I have one sheet, that represents an overview of the data from the two other export sheets. So when I have for example the value "Te1" in the cell A2 of my overview sheet, I want Excel to search in the two export sheets the value "Te1" and give back the value in the same row as "Te1" but of the column "Problem", so that I can fill the cell B2 where I want to have the Problem type. So I thought I might need the "MATCH" formula, to let excel know I want to search the column with the headline "Problem" in the export sheets, to fill the column "Problem" in my overview sheet.
The problem that I see is that I have to search TWO sheets and I don't know in which one the "Pm1" will appear. Furthermore I don't know in which column of the sheet "Problem" will appear.
Can you please help me? I would preferably like to solve the problem with a formula, not a macro. Thank you very much in advance.
Kind regards,
question

To find the index of the first column in one of your sheets that is headed 'Problem', you can use (e.g.):
=MATCH("Problem",Te_open!$1:$1,0)
Let's assume we place that formula in a cell somewhere and name the cell open_col. To find a value in column A of Te_open and return the corresponding value from the 'Problem' column, you can then use:
=VLOOKUP(A2,Te_open!$A$2:$Z$999,open_col)
Note that you'll have to define the search range to include the largest range that your data on Te_open could occupy. If the search value is found this will return the corresponding value from the 'Problem' column, otherwise it'll return #N/A. So if you've also set up a cell called closed_col to get the column index for the Te_closed sheet, you can do:
=IF(ISNA(VLOOKUP(A2,Te_open!$A$2:$Z$999,open_col)),VLOOKUP(A2,Te_closed!$A$2:$Z$999,closed_col),VLOOKUP(A2,Te_open!$A$2:$Z$999,open_col)
That gets the result from the correct column of Te_open if the search value was found there, otherwise it gets the result from the correct column of Te_closed. If neither sheet contains the search value it'll return #N/A.

Related

Excel: Extract data from well beneath unique identifier

I have a spreadsheet full of data (simplified example below) that I would like to extract the number in the well underneath of "Gimme the number" and paste it into a new column on a separate sheet (i.e. if "Gimme the number" is in G6, I would like to retrieve the value for G7). I do not have access to Excel VBA and have not used macros in the past. I found some examples linked below, but, from what I understand, they would return "Gimme the number", or "Gimme" not 19, 20, and 21. I am not sure if a pivot table is appropriate, because I only want information from a single column. I will only have up to 11 values to extract at any given time, so I think a formula would do it. I am just having a hard time coming up with one that works. Any help would be greatly appreciated!
Search for a text string and return multiple adjacent values
Return multiple matches with wildcard vlookup
I am not sure I get the question well, but I try.
First add a column right of the column with "Gimme..." values. Name it e.g. "Next_value" in the first row. Put in the formula referencing previous column next row. If "Gimme..." is in the cell (for instance) E6, than your formula in the cell F6 is =E7. Copy that formula into the whole Next_value column.
Than select area of these two columns (Label, Next_value) and apply the filter from the Data toolbar. Use the small buttons with triangles at the top of the column Label to adjust the filter so only "Gimme..." rows are filtered.
Now, copy values of Next_value column where you like. If you want just the references, use Paste special function from the Home toolbar and click Paste link button.

Excel/VBA check if a whole row is present on another sheet

A quick question. I am trying to detect if a row is present on another sheet. Simply said, if article+description+quantity+serial is present on another sheet, output a "Y" otherwise, output a "N". The problem I am facing with this, is the fact that the rows on the other sheet could be anywhere, there isn't a fixed position, only the column is known.
However, both the sheet on which the Y/N calculation has to be made, as the sheet on which the row should be searched/found, are dynamically generated by the means of VBA.
Example of the tablestructure
Looking at the =COUNTIFS, I am actually wanting to have =COUNTIFS(A1;="Sheet2!A1:D100"), but the COUNTIFS functionality doesn't support the "range" lookup. I just want to search "ROW(1) in Sheet2!A1:D100"...
Does anyone know in which direction I should be looking?
You could use a Helper column which combines Number, Description & Serial.
Formula for Helper column:
=$I3&"_"&$J3&"_"&$L3
Formula for Instock column:
=IF(COUNTIF($M$3:$M$6,$E3)>0,IF(SUMIF($M$3:$M$6,$E3,$K$3:$K$6)>=$C3,"Y","N"),"N")
Instock formula checks if the value in the Helper column of Sheet1 appears in Helper column of sheet2. If appears, it is also check the sum of available parts satisfy the amount needed.
Output:

select the same rows from a column between two spreadsheets or two columns

I have thousands of entries for the same site names taken between different days. However not all row labels are identical. I just want to select all row labels that are shared among both spreadsheets based on the names contained in column A for example and copy them to a new sheet. Filtering and selecting wont work, theres thousands and different entries between the two. I just want to delete entries that are not shared among both spreadsheets.
I looked through other forums using vlookup but I am not sure i understand the syntax:
e.g. i looked at this forum: Matching two columns from two spreadsheets and grabbing data from one of the spreadsheets
it proposed this solution: =index(sheet2!B1:B3;match(sheet1!G1;sheet2!A1:A3;0)). So this solution join row from 2nd sheet to row first sheet. If column G 1st sheet and column A 2nd sheet are the same then you can use this to match. Place formula in column H 1st sheet. With this formula you will fetch data from column B 2nd sheet to column H 1st sheet.
I dont think this is the case since the positions of similar row values in both columns differ. I just want to know what labels are shared among both and delete entries that dont share those names
example of output
Yes vlookup is the key because if you lookup something in spreadsheet1:colA to see if it is in spreadsheet2:colA if it is not present you will get a null value. Then you can filter out these nulls to get only the list of rows which share the column A value in spreadsheet2. You will also need to repeat this in spreadsheet2.
For context, assuming the image you posted covers cells A1:C6, and your highlighted cells are A4:C5 then:
In sheet1 cell D3 put =VLOOKUP(A3, Sheet2!A:A, 1,0) and copy down for the rest of column D, and in sheet2 cell D3: =VLOOKUP(A3, Sheet1!A:A, 1,0)
IF the vlookup finds a match, this will give the exact same value in columnD which is present in both spreadsheets, otherwise it will give #N/A. Then you can filter those out.
(By the way the syntax for the sheet name depends on whether you have spaces in the name so Sheet1!A:A but 'Sheet 1'!A:A, I usually get these by highlighting them so excel does the work of naming the worksheet).
A side note, I would drag both worksheets into one file, you certainly can perform vlookups between different files, but this then relies on the exact file path so if you ever move either file, the vlookups will break and give you errors. I only ever vlookup within the same file.

Fill data in excel sheet from master list from another sheet

I have data in two separate excel sheet in single file.
In the first sheet, I have two columns...like this
Sheet1
In the second sheet, I have one of the column which is same as Name in Sheet1. However, it does not have second column where I want to bring the value referring to the sheet 1.
Here is the second sheet.
Here in second column, i.e. Color I want to bring the value from first sheet.
I am using Libreoffice but can use excel as well. Pls suggest how I would do this in excel / libreoffice.
Solution for Excel...
So use sheet one as the reference sheet. Sheet two as the one you want to fill.
In B2 on Sheet 2 enter this formula:
=vlookup(A2,Sheet1!$A$1:B$6$,2,FAlSE)
Then drag down.
This is assuming that your reference in sheet one is in columns A and B and goes from rows 1 to 6.
Hope this helps.
One of the easier ways to do this would be to use VLOOKUP. So this requires 4 inputs:
The value you are searching for
The array you are searching in
The column where the value you want to return is in
"FALSE" to list if you want an exact match between the value you are searching for and the array you are searching in.
So in your example, we will use the worksheet where you only have the Names listed as the worksheet you are putting the formula, so something like this in B2:
=VLOOKUP(A2,sheet2!$A$2:$B$6,2,FALSE)
So this would lookup the value you show in worksheet 1 cell A2.
Then go to workbook 2 and match that value with what is in A2:A6.
Then lookup what is in column 2 for your answer.
And return what is in column 2 only if worksheet 1 cell A2 and something in worksheet 2 range A2:A6 is an exact match.
There are other ways, but for your example, this should be easiest in EXCEL. This only works if the value you are searching for is to the right of the value you are looking up. If you need to go to the left, INDEX/MATCH would be better (but not required here).
Hope this helps!
JW

Excel how to: compare values, find the same, compare their adjacent values, find the bigger and return this number +1 at another sheet

enter image description hereI am working at Excel.
I have a value (letters) in a cell and i would like to:
find similar values of another column in another sheet.
Then i would like to compare the values of this "group" which are located at the next column.
Then i would like to find the bigger and add to it +1.
Finally I would like to write the result in a cell in the initial sheet.
Could you please help me?
how my sheets look
If I've understood correctly it should just be a COUNTIF
=COUNTIF(Sheet2!B2:B6,D11)+1
placed in Sheet1 E11.
If you wanted to do it by finding the largest number in Sheet2 C2:C6 with the same group of letters, the neatest way to do it is using AGGREGATE
=AGGREGATE(14,6,Sheet2!C2:C6/(Sheet2!B2:B6=D11),1)+1

Resources