I have a Table in excel like the following one:
col1 col2
A 1
B 0
A 2
B 2
B 3
I was not able to find a way to select a subset of the table like this one using an excel function.
col11 col22
B 0
B 2
B 3
based on the value "B" of column col1 or just be able to select the col22' from the given subset.
I would like to have a solution that does not require to VBA nor array formula. I found on Internet the function FILTER, but it is not available yet and Structured References does not have such functionality.
I would like to use for example the result col22 as a column at another place of my spreadsheet. Other languages such as R, provide a function subset that does this in a pretty simple way. In excel it is really easy to filter using the Excel interface (filter button), but I am not aware of a function that does something similar programatically.
I had the same problem and the only thing I found on the internet was the FILTER function too.
I wanted to vlookup a subset of a table based on another column. My solution was to make another column that is the concatenation of the two. Then I used vlookup on this column.
I don't know what are you going to do with the subset table that you want to have. But you can do it in a different way as I did. May it helps.
Assuming col1 is A and col 2 is B and your result set's col1 and col2 are E and F respectively, try this formula in column C: =IF(A2=$E$2,MAX($C$1:C1)+1,0)
Now, in cell E2 (i left the first row for a header), i physically typed "B" to make this the input source and allowing for dynamic reporting. for as many cells below that as you wish, the following formula will only show the total number of "B"s that are in your input source: =IF(ROW(A2)>MAX(C:C),"",E2) Notice i did not fix the cells with $ as your following row depends on the former.
Cell F2 (the top of your col2 field for the result set) include: =INDEX(B:B,MATCH(G2,C:C,0)) and in G2 put: =IF(E2="","",G1+1) and copy both down as far as you have formulas in column E (or result set col1).
The reason for the IF statements is for formatting rather than displaying errors on failed lookups.
Goal: extract a subset of the current sheet only when values in the first column match a value in the first column of another 'Sheet1':
=VLOOKUP(A2,Sheet1!$A:$B,2,FALSE)
Add the formula above in the first cell of the first empty column, then sort Z-A this column and remove all "#N/A" rows, then re-order again A-Z the first column and remove this temporary column.
Related
I am in need of an advanced lookup formula that will search through data from one table and produce a value based on conditions from another table.
What I am trying to achieve is this:
If Column J in Table 1 is equal to column A in Table 2 and
Column L in Table 1 is equal to Column D in Table 2
But Column D in Table 2 is blank but there are values in Column L of Table 2 except the value specified in Table 2 previously
And Column G in Table 1 is equal to Column B in Table 2
But Column B in table 2 is blank but Column G in Table 1 has values except the one specified previously in Table 2
And if Column O in Table 1 is equal to Column C in Table 2
But Column C in Table 2 is Blank and Column O in Table 2 contains values other than previously specified in Table 2
The end result should be column E in Table 2.
I used this formula but it is showing a value error
=IF(AND(Trans!J:J=Mapping!A:A),Mapping!E:E),IF(AND(Trans!L:L=Mapping!D:D),Mapping!E:E),IF(AND(Mapping!D:D="",Trans!L:L<>""),Mapping!E:E), IF(AND(Trans!G:G=Mapping!B:B),Mapping!E:E),IF(AND(Mapping!B:B="",Trans!G:G<>""),Mapping!E:E),IF(AND(Trans!O:O=Mapping!C:C),Mapping!E:E),IF(AND(Mapping!C:C="",Trans!O:O<>""),Mapping!E:E)
The formula can also be searching by row. I would just like something that works!
Please help.
Your formula is doing nothing, it seems you are combining all the logics you thought in one place, but it is not in a form that excel can understand.
As per my understanding you have to remove the blank checks, as per your data they may return unexpected results, if their is one blank or if there are more in both cases result would be different, you would not know the reason of a returned value. (it is not logical to make a check like that)
A logic like this may return more than one value, you have to put some formula in case there are more values returned.
AS for the formula, you are comparing a full column with a full column. It is not recommended to do that, the recommended way is to compare one value to a range of values and the function AND() is not required in the way you are using it
a comparison in the formula would be something like
=IF(Trans!J3=Mapping!A3:A20,Mapping!E3:E20,"")
and it is an array formula that can return multiple values
At the end summary is that first you have to define the logic you are making, it is not clear and not accounting for all possibilities after that learn how to apply such formulas and then apply it on your data.
Is it possible to return a given custom value while performing a multi-column search in excel?
I have 2 sheets,
In the first sheet I have 3 columns, and each column have several rows with unique numbers.
In the second sheet I have 2 columns, the 1st column in this sheet2 has a unique number that can be found in sheet 1 columns 1,2 or 3.
In column 2 in this sheet2 I want to display a custom text if the value in column 1 is found in any of the 3 columns in sheet 1.
For example if the value in sheet2/column1 is found in sheet1/Column3, the text should be = "Value Found in Column1", if the value is found in sheet1/Column2, the text should be = "Value Found in Column2", if the value is found in sheet1/Column1, the text should be = "Value Found in Column1".
Is this possible, can you give an example of this?
Thank you.
Yes this can be done. I could write the function for you but I think you would be better off trying to write it yourself. Here is how I would go about it. Write a vlookup() in columns B, C, and D of sheet2 corresponding to the columns A, B, and C of sheet1. If vlookup() returns a match in any of these columns, then that value exists in one of the three sheet1 columns.
The next step is to use isna() to return a boolean value of whether vlookup() returned a match. Again, you'll need one of these for each vlookup() (three total).
Lastly you can use and() on the isna() columns to check if all three are #N/A. Based on that boolean value, you can you if() to return your custom text.
Obviously the process I described splits the problem up into many columns. These functions can be combined to fit into one horribly nested function and put into one cell if you really want, but that's up to you. Let me know if you have any trouble.
I have 2 sets of data. I put it in Excel e.g. column A and column B. Now I want to know which data from B is part of column A. I run this formula =IF(COUNTIF($A$1:$A$327238,B1)>0,"Exist", "Nope")
Then I 'filter it and look only 'Exist'. Based on that I know that all data in B that has label 'Exist' is part of column A
Now I want to know opposite i.e. which data from A are part of B. For that reason I use the same formula but I replace the data in columns i.e. data from B now in A and vice versa.
Then I randomly verify results.
For case 1 it looks it works fine but for second case it looks it's not accurate.
My assumption: should it work in case 2 as well ( maybe I just was not very accurate in some way ) and I should expect it to work?
Thanks
In cell C1 (assuming your data starts from 1st row) type the following =IF(A2=B2,"equal","no"), and then populate the same formula to the last row where there is still data, so that for row N, your formula in column C is =IF(AN=BN,"equal","no"). After that you will just need to count the cells with value "no" to know the differences. Sorry if I didn't get the question correctly.
Ok, assuming that the two sets of data are in columns A and B (they might be of different sizes), and the last rows of data are L and M respectively, click on D1 and type the following: =IFNA(INDEX(B$1:B$5,MATCH(A1,B$1:B$5,0),1),"Unique"). Drag down to apply this formula on D1 - DL. That's it, you have the duplicate elements. Since the duplicate elements are the same in both columns - A and B, you don't need to repeat this for column B. Note, that for all the unique elements the corresponding rows of column D have the word "Unique", so if you want the unique elements, you can just get the elements from A with the mentioned row numbers:
Just select any column's first row cell and type the following formula: =IF(D1="Unique",INDEX(A$1:A$L,ROW(D1)),"Duplicate").
The issue I'm faced with is I have two sheets of data in Excel. They are a stocksheet list, listing items that have a variance from a stocktake. The items are randomly placed between both documents, so it is almost impossible to do a side-by-side view even if I were to order the columns (which I already have). For example it would be like this:
Sheet 1:
A1 (Apple) (1)
A2 (Carrot) (-3)
A3 (Banana) (4)
A4 (Chocolate (-7)
Whereas Sheet 2 may be:
A1 (Orange) (-2)
A2 (Apple) (3)
A3 (Muffin) (-8)
A4 (Carrot) (3)
So as you can see, the same data may appear, and if it does I want to compare those two sets, to know the variance, i.e. Sheet 1 said -3 whereas sheet 2 said +1... I preferably would like to do this in a batch if possible, as there are over 800 cells to go through.
Just so that you can see what I'm dealing with, here's links to pastebins of both sheets;
Sheet 1: http://pastebin.com/6i7QKJ6N
Sheet 2: http://pastebin.com/zjtC2U7q
Is there anything anyone can think of that would be able to assist me, other than me going through this one by one which I am considering doing?
Excuse me from avoiding the real situation and sticking with your example. Assuming the values are in ColumnB in the corresponding rows, then:
in Sheet1: =VLOOKUP(A1,Sheet2!A:B,2,FALSE)
in Sheet2: =VLOOKUP(A1,Sheet1!A:B,2,FALSE)
say in ColumnsC should 'align' the entries (where both exist, otherwise #N/A). =B1=C1 in D1 copied down should then help to identify the mismatches and say =B1-C1 in E1 copied down the quantification the discrepancies between the sheets, by 'vegetable'.
There should be no need for a batch mode for this.
I'm assuming that the unique identifier for the stock items is the column labelled CYSKU, right?
If that's so, then there are only 192 common items between the two sheets. I ran a vlookup in both sheets a bit similar to the one pnuts used and used a filter.
There are more variances between CYCOST than with CYRETL as far as I can see (I haven't compared the other columns).
To perform the comparison, you can do the following:
Insert a column between columns C and F (just after CYSKU) and put a vlookup formula in row 2 of this column and fill it down:
=VLOOKUP(C2, Sheet2!C:C, 1, 0)
Insert a filter and filter out #N/A from this column to get only those that are common between the two sheets.
In column M (after CYDVAR), insert another vlookup and fill it down:
=VLOOKUP(C2, Sheet2!C:F, 4, 0)
This will give you the corresponding CYRETL from Sheet2. You can then compare the two CYRETL.
How VLOOKUP works:
The first parameter is what VLOOKUP will be looking for.
The second parameter is the table range in which to look the first parameter.
The third parameter is the nth column from which a match will be returned, limited to the table (if the table is in column A:A, only 1 column is available, if the table is A:B, 2 columns are available, etc).
The last parameter is for either exact or approximate match. Exact is 0 (or FALSE) and approximate is 1 (or TRUE).
You can just change the table range and the column number to change the value you're looking for from Sheet2.
I'm trying to do something in Excel without using VBA macros. I suspect it is possible, but have some up empty so far. Basically for values in a table, I'd like to retrieve a list of all values in Column A conditionally where Column B equals a value I provide.
For example I'd like a function that essentially returns a range/description of cells for Column A if Column B is equal to zero.
Column A Column B
1 0
2 0
3 1
4 0
would return a range describing cells a2, a3, and a5 (1, 2, 4). I'd prefer to be able to do this using a formula, and not manually using pivot tables. I would be willing to create a view of the data using pivot tables if that table could then be referenced via a function to give me the appropriate results. I am also able to sort Column B in any way if it makes it easier to do this.
Ultimately I need to pull out a random value from Column A that meet the criteria of Column B in case that matters in the final solution.
Thanks.
Use an array formula.
Type in:
=INDEX($A$1:$A$4,SMALL(IF($C$1=$B$1:$B$4,ROW($B$1:$B$4)),ROW(1:1)),1)
then press Ctrl+Shift+Enter. Drag and fill the cells below until #NUM! shows up. This formula assumes the value you're looking for is in C1 and there are no headers (data starts in 1st row rather than 2nd).