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.
Related
Looking for help with this task. Here's is a portion of the table I'm working with:
What I'm trying to do is have the cells in Column B (MWD) return the value of the adjacent cells in Column C (Pseudo). Column A (Data Set) has the same values as Colum B but including duplicates. I need a formula where the duplicates in Column A will return the same value that it matches in column B.
Example: I need...
all the duplicate 1010001's to return pseudo 1
all the duplicate 1020001's to return pseudo 2
all the duplicate 1020002's to return pseudo 3
and so on...
I was trying to use index match function but don't know if I'm constructing the formula wrong or if it's the correct formula to use.
If data is sorted by column A, you can use one formula:
=IF(COUNTIF($A$1:A2,A2)>1,C1,C1+1)
if not, then other
=IF(COUNTIF($A$1:A2,A2)>1,INDEX($C$1:C2,MATCH(A2,$A$1:A2,0)),MAX($C$1:C1)+1)
in both cases copy the formula in second row (in C2 cell in my examples). To the first row add 1 manually.
First example:
Second example:
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.
I have two tables of data, call them table 1 and 2. In table 1 there is a long list of reference numbers. Each reference number has its own cell.
In table 2 I have the exact same reference numbers; however, in table 2 these reference numbers may or may not share that cell with another reference number. See below. The bottom three reference numbers in table 1 all share the same cell and are separated by a comma always.
Imagine table 1 and 2 are on separate tabs of the same workbook.
table 1 and 2
On the work sheet for table 1, I am trying to bring back the month found adjacent to the reference number in table 2. I am trying to take the value in table 1, search it in table 2, and return the month so that I get this result:
result in column b of table 1
I would like to avoid delimiting the values in the shared cells of table 2.
Thanks in advance for your help!
If your reference number are unique, you can get by with doing a wildcard vlookup
Assume you have a range in columns F and G where your reference numbers and months are. In Range A:B you want the values.
Essentially you are looking up like this.
If my value A1 is in column F and it matches a substring get the value from G
So you would use this formula in B1
=VLOOKUP(CONCATENATE("*", A1, "*"),$F$1:$G$6,2, FALSE)
what this is doing is, get the value from A1, and match the range of F:G where the first column CONTAINS A1, get the value from the corresponding G column
From there copy paste the formula for the rest of the
cells in B column
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").
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).