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.
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 a dropdown list of 104 values in column F. I want if any of the values is selected from that list cloumn, a corresponding value should be referenced from sheet and be inserted the cell in Column i .
If a value is selected in sheet 1 column F then it should match it with a similar value in sheet 2 columnA and also select the value corresponding value in Sheet 2 column B and go back and insert it in sheet 1 Column i.
Please note that each of the 104 values in column F has its corresponding value from a cell address of another worksheet
worksheet with dropdown list column F and inserted value column I
worksheet with referenced value
use Index/Match
=Index("select the data that you want displayed",match("common data", "common data",0))
I use this a ton when pulling data from multiple tabs.
=index(List of Customers,match(tab1_CustomerID, tab2_CustomerID,0))
hope this helps!
That calls the use of two possible functions:
The first is VLOOKUP, which you can find about in here:
https://exceljet.net/excel-functions/excel-vlookup-function
(please note the 4th parameter!!!!)
The second combination is index/match, which I think is more appropriate for your situation:
https://www.ablebits.com/office-addins-blog/2014/08/13/excel-index-match-function-vlookup/
Or here:
https://exceljet.net/index-and-match
Less theoretical but with the best explanation:
http://www.randomwok.com/excel/how-to-use-index-match/
more complicated but fits your purpose better
Index/match with more than one column to match against:
https://www.deskbright.com/excel/index-match-multiple-criteria/
I need to sum all values in Column A where Column B is a duplicate.
Above is a sample of the data. Column B has urls and Column A has counts for the urls. What I want is to sum the values in Column A for duplicate values in Column B.
Example:
The output for _.apelabs.net should be 6.
How can I achieve this?
I think you are looking for the function =COUNTIF(Range,Criteria)
Here is a link that shows a usage example.
As #Andresson stated, if you're trying to count the number of times a specific url appears, you might want to use the COUNTIF function: =COUNTIF(range, criteria).
COUNTIF Example:
Using =COUNTIF(B:B, "_.apelabs.net")
would return 3 in your sample data (assuming your image includes the only instances of "_.apelabs.net").
This example of the COUNTIF function is the same as saying, "count the total number of times a cell in Column B (i.e. B:B) equals "_.apelabs.net"."
However, if you're wanting to sum together all the values in Column A where the corresponding url in Column B matches the given criteria, you'll want the SUMIF function: =SUMIF(range, criteria, [sum_range]).
SUMIF Example:
Using =SUMIF(B:B, "_.apelabs.net", A:A)
would return 5 in your sample data (again assuming your image includes the only instances of "_.apelabs.net").
This example of the SUMIF function is the same as saying, "each time a cell in Column B (i.e. B:B) equals "_.apelabs.net", sum together the values in Column A (i.e. A:A) that are located in the same row as each "_.apelabs.net" found in Column B."
Additionally, you can also use a pivot table, as #ScottCraner suggested. It's all a matter in how you want to present your findings.
I have to compare column having same values but not in the same order.
I want to pick the first value in the first column and then find it in the second column.
If I find it then I want to copy it in the third column with the number of records.
I want to repeat this exercise for every value in the first column.
What you're looking for is called VLOOKUP() and is a built-in function of Excel that will do it exactly for you. You can read more about VLOOKUP() here. Examples have also been provided.
Let's suppose that the first column is A and the second column is D (based on your picture) and you want the number of records displayed on column E. In this case you should set the following formulas on E1, E2,... cells:
E1 ----> =COUNTIF(D:D, A1)
E2 ----> =COUNTIF(D:D, A2)...