How do I search across sheets in Excel - excel

I want to transfer data automatically from 2 sheets to one single combining one. That means I have 2 different exports that contain both the columns "Problem". I have one sheet, that represents an overview of the data. So when I have for example the value "A333" in A1 of my overview sheet, I want Excel to search in the two other export sheets the value "A333" and give back the value in the same row as "A333" but of the column "Problem" not "A".
The problem that I see is that I have to search TWO sheets and I don't know in which one the "A333" 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.

1) write a formula (VLOOKUUP() for example) that looks for the value in the first sheet
2) write a formula that looks for the value in the second sheet
3)since VLOOKUP returns an ERROR if a value is not found you can combine the formulas together using IFERROR(). for example: =IFERROR(VLOOKUP(ref_cell,sheet1_range,2,0),VLOOKUP(ref_cell,sheet2_range,2,0))
EDIT:
It looks like you did not provide all the pertinent information in your question!
I suggested VLOOKUP(), but this will only work if you know which COLUMN the value you are looking for will appear in, but you said this is not the case...
using you comments I therefore assume the following:
the two test sheets are called "test1" and "test2"
The reference value we are looking for is in cell A5 on the main sheet, cell D1 on the sheet contains "Problem" (text)
The reference value may appear anywhere (I limit here to range A1:J100) on test1 or test2, but ONLY ONCE
The column "Product" on test1 and test2 may appear in different columns, but it will always have a heading "Product" in row 3 (test1!A3:J3 and test2!A3:J3)
see below of screenshot of the answer (column C shows result, column D shows the underlying formula)
If required use the information provided to create a single-cell formula (because Stack Overflow is not a we-write-the-answer-for-you service)

Following the scheme:
and add the formula:
E3 -> =CONCATENATE(IFERROR(VLOOKUP(D3;$A$12:$B$15;2;FALSE);"");IFERROR(VLOOKUP(D3;$A$3:$B$6;2;FALSE);""))
and autocomplete ...

Related

Multiple Cells Check Without VBA?

So, trying to explain what I need here is my two sheets on the same workbook, Sheet Example:
I need to make a formula for each cell that checks Sheet A "Num_Doc_Ini" and "Num_Doc_Fin" against Sheet B "CHV_CTE_REF", calculates the total after adding up the "VL_DOC" numbers on Sheet B, and finally Checks with "correct" or "Incorrect" after comparing the result to the Sheet A "VL_DOC".
So for example, the second line of Sheet A. I need to make so that check see's the NUM_DOC_INI and FIN so "101 - 102" checks those numbers on Sheet B "CHV_CTE_REF", adds up the "VL_DOC" so in this example 4,159.86 + 4,585.1 that equals = 8,744.96, and then matches it with the "VL_DOC" on Sheet A displaying in this case the text "Correct" and If it does not match displays "Incorrect".
Some lines have few docs to reach like "106 - 108" but there are some that have 10 or more to read and sum up the values, because of that I'm really breaking my mind trying to come up with something.
Is that even possible? I can think of a few ways to use VBA for this but I'm trying to do this all with Cells Formula and because of that I am kinda lost, any help would be appreciated thanks!
Edit:
I'm using excel 2016 atm.
So here is a file for the workbook: https://mega.nz/file/LgVCBbjT#xJnf2HbHd6wdRSNPY7wXSssKv2jZ1-pMsOuKcePlulQ
And the explanation with colors:
I need on the Red Cell a formula to check the numbers of the Blue ones on sheet 1, find them on Sheet 2 (blue cells), add up the VL_DOC (Green ones) on sheet 2, and check them up against the values on Sheet 1 Orange cells (VL_DOC), then print out Correct or incorrect based on the match of the values.
From what I can see in the link, you can use something like the below if you have the newest version of excel (where row ranges and column references are left to your specific case because we can't see them):
=IF(SUM(FILTER(SheetB!$VL_DOC,
(SheetB!$CHV_CTE_REF=SheetA!J2)+(SheetB!$CHV_CTE_REF=SheetA!I2)+...))=N2,
"Correct", "Incorrect")
Then add however many other conditions within the FILTER function you need. For example:
REQUESTED EDIT: If you don't have the newest version of excel, you can just repeatedly use VLOOKUP or INDEX/MATCH however many times is necessary. For example:
=IF(SUM(
VLOOKUP($I2, SheetB!$CHV_CTE_REF, 2,),
VLOOKUP($J2, SheetB!$CHV_CTE_REF, 2,),
...)=$N2,
"Correct", "Incorrect")
SUM, INDIRECT, ADDRESS, MATCH
Note that INDIRECT is a volatile function.
In cell K2 of Sheet 1 of the example workbook, you can use the following formula:
=IFERROR(IF(SUM(INDIRECT(ADDRESS(MATCH(H2,Tabela1[NUM_DOC],0)+1,COLUMN(Tabela1[VL_DOC]),1,1,"Sheet 2")&":"&ADDRESS(MATCH(I2,Tabela1[NUM_DOC],0)+1,COLUMN(Tabela1[VL_DOC]),1,1),TRUE))=J2,"Correct","Incorrect"),"")

Read for specific text, and copy text from another sheet

I'm trying to copy text from sheet1, over to sheet2, depending on the header.
=IF(Sheet1!A1=Sheet2!A1,Sheet1!A2:A40,(IF(Sheet1!B1=Sheet2!A1,Sheet1!B2:B40,(IF(Sheet1!C1=Sheet2!A1,Sheet1!C2:C40,(IF(Sheet1!D1=Sheet2!A1,Sheet1!D2:D40,(IF(Sheet1!E1=Sheet2!A1,Sheet1!E2:E40,(IF(Sheet1!F1=Sheet2!A1,Sheet1!F2:F40,(IF(Sheet1!G1=Sheet2!A1,Sheet1!G2:G40,"")))))))))))))
=IF(Sheet1!A1=Sheet2!A1,Sheet1!A2:A40,
(IF(Sheet1!B1=Sheet2!A1,Sheet1!B2:B40,
(IF(Sheet1!C1=Sheet2!A1,Sheet1!C2:C40,
(IF(Sheet1!D1=Sheet2!A1,Sheet1!D2:D40,
(IF(Sheet1!E1=Sheet2!A1,Sheet1!E2:E40,
(IF(Sheet1!F1=Sheet2!A1,Sheet1!F2:F40,
(IF(Sheet1!G1=Sheet2!A1,Sheet1!G2:G40
,"")))))))))))))
This unsightly mess is what I've got so far, but it only works about 57% of the time. I have no idea why.
Say for example, that the headers were Test1, Test2, Test3 etc, how could I make it so that excel reads sheet1 for the header Test1, and copies the column starting the cell beneath, and copies it over to whatever column Test1 is on in sheet2?
I have a rather basic understanding of excel formula, and even less of VBA, so any help is welcome.
This is a good task for INDEX(), by passing a 0 for one of the arguments you can state that you would like the whole column to be returned (or all rows of the matched column to be more precise):
=INDEX(Sheet1!A2:G40,0,MATCH(Sheet2!A1,Sheet1!A1:G1,0))
Without some example data and expected output I am unable to justify whether this is exactly what you are after though. Please feel free to provide more scope and leave me a comment, I will update my answer.
EDIT:
To get the results for the columns, you would assemble a lookup something like this:
=INDEX(Sheet1!$A$2:$G$40,ROW()-1,MATCH(Sheet2!A$1,Sheet1!$A$1:$G$1,0))
So that you index the data you want to be returned, then return the current row that you are on (offset by -1 as the data begins on the second row). The MATCH() at the end returns the position of the column title that matches Sheet2!A$1.
The $$ is important here as the absolute referencing will stop the formula from changing when you drag it across the sheet (Sheet2!A$1 will only update when dragged horizontally but not when dragged vertically)

Excel VLOOKUP/ INDEX multiple times based on value

So I want to be able to change the values from Pic2 in rows "ZERO" and "LINE-IN" and have it reference the table to output the value from the even number of rows. In Pic2 if I enter "AA","CC","BB" into row "ZERO" and "3","2","1" into row "LINE-IN" then it would take "AA" from "ZERO" on Pic2 go to column A on Pic1 and find the match, then Look within row 1 Pic1 to find "3", then output "Z" from row 2 into the "LINE-OUT" row. So, the value "CC" in row "ZERO" with value of "2" in row "LINE-IN" will output the value of "X".
I have came across a few possible ways to accomplish this using VLOOKUP, INDEX, MATCH, and IF. All solutions and the ways I can think to do what I asking requires to build multiple tables and that doesn't seem very practical the way I am imagining.
I am really looking for one or two formulas that I can reference instead of making several different tables to accomplish the same thing.
Thanks for any help or guidance towards a solution and sorry about having to follow the links for the pics.
I'm confused about how you've set your table up. If you set it up as follows:
then it is a very simple Index/Match function.
For instance, if the tables were arranged as above, then the formula in cell B8 that will change as you change cells B6 and B7 is:
=INDEX($A$1:$D$4,MATCH(B7,$A$1:$A$4,0),MATCH(B6,$A$1:$D$1,0))
and you only need one table

Excel countif does not look up a different sheet

I am hoping someone can help with this Excel 2016 issue. I have done extensive searching on the net and believe I have found the formula to address my requirements. Before sharing the formula, let me explain my need.
I am creating a budget spreadsheet. There is currently two sheets in the spreadsheet. sheet1 contains data for categories and keywords. Column A contains different categories like Car Fule, Salary, Bank Fee, etc. Column B contains keywords to be search for within the transaction description. An example could be:
car fule | Mobile
Sheet2 contains all the transaction data. All the columns other then column c isn't relevant for this issue. An example of a transaction description could be: "EXP mobile Hobbitville 2221 MiddleEarth".
I am trying to create a formula that does a search in the defined cell for column c, against the keywords found in sheet` column b. Then once a match is found, perform a indirect function call to give the category of the transaction. I cannot get the initial search to work.
Formula that should work is:
=countif(c2,"*"&sheet1!$b$1:$b$85&"*")
This always gives a value of 0 saying it hasn't been found. I am using ctrl shift enter and ctrl enter to make the an array formula. If I press f9, I get all the values defined from sheet 1 as {0, 0, ...} (or something like that) which is what I expect. In that array, I should get at least one element as a '1' (true value). If I can fix this part of the formula or find a better method, then I can build the rest of the formula. Any one with ideas?
This is the COUNTIF syntax,
COUNTIF(range, criteria)
It should be the other way around,
=COUNTIF(C:C,"*"&Sheet1!$B1&"*")
Let me know if its not working

How to tell if a cell exists on another Google Sheet

I have 12 sheets in one Google Sheets document labeled for each month (January - December). On each sheet column A contains a project number, e.g. "6091".
I'm trying to find a function that will check all of the other sheets to see if there are duplicate cells in the "project number" column of other sheets.
So: "Do any of the cells in column A, match any of the cells in column A on other sheets".
Is there a quick way to do this?
The formula =arrayformula(iferror(match(A2:A, AnotherSheet!A2:A, 0))) checks each value in A2:A of the present sheet for being in A2:A of AnotherSheet. If it's there, it returns the position in AnotherSheet, otherwise the output is empty (the error #N/A is suppressed by iferror).
You can use the above for each of the sheets separately. Alternatively, if you are not interested in the positions and just want to know which entries from A2:A are found elsewhere, then add the results for each sheet:
=arrayformula(iferror(match(A2:A, AnotherSheet!A2:A, 0)) + iferror(match(A2:A, ThirdSheet!A2:A, 0)))
The output is 0 is there is no match, and a nonzero number if there is.
You may try using this to find the number of duplicates:
=counta('JAN'!A:A,'FEB'!A:A)-countA(unique({'JAN'!A:A;'FEB'!A:A})
Where A:A is your column for the data you want to check and the respective files.
This formula counts the total number of data you have, minus the unique data, therefore giving you the total number of duplicates in your dataset.
This formula gives you an overview of the total number of duplicates, however, it doesn't show which cell is a duplicate.
Alternatively, you can add a checker column and input the following formula to check if that specific cell is a duplicate.
=match(cell to check,{range 1;range 2;...range 12})
Alternatively, you may use this formula to find the exact duplicates between the ranges, however this formula does not search within the range itself for duplicates.
=arrayformula(filter(range to check,(countif(arrayformula({Range 1;range 2}),{range to check}))>1))
Personally I think that the last option would be the best as it gives you the exact data to correct.
I am still new to this so hope this helps:)
This formula should work for numerical values:
=COUNT(QUERY({March!A:A;April!A:A},"where Col1="&A2))
If you are searching for text values it would be
=COUNTA(QUERY({March!A:A;April!A:A},"where Col1='"&A2&"'"))
Unfortunately the QUERY function does not work within an arrayformula so you would need to copy the formula down the column. You can add in extra sheets into the { } array as required, separated by a semi-colon
Edit: actually, borrowing from #sandwich, this version should work without the need to copy the formula down the column:
=arrayformula(iferror(match(A2:A,{March!A:A;April!A:A},0)))

Resources