Match function for more than one criteria - excel-formula

I want to get the row number of the row having 2 as ID and A in second column.

Related

Is there an "if" function in Excel for auto-filling a user ID number based on a separate user ID number that's already been found?

I am trying to auto-fill a person's user ID number based on repeat information in the table. I have an excel sheet with people that have two user ID #'s so I would like to auto-fill the second number based on the first. i.e. I have 3 columns. Column 1 = name, column 2 = user ID #1 and column 3 = user ID #2. So if Gerald = 3 and 5, how do I get excel to auto-fill the user ID #2 as 5 every time column 2 = 3. It's the same data repeated over and over. As in I have multiple Gerald entries and I want it to auto-fill everytime he comes up based on his first user ID#. It's all in the same sheet so I don't have to switch tabs or anything.
I've tried going through "if" functions but I don't know how to make the right formula.
You can use the VLOOKUP function in Excel to achieve what you're trying to do.
The VLOOKUP function searches for a value in the first column of a table and returns the value in the same row from a specified column. In your case, you want to search for the first user ID # in column 2, find the corresponding name in column 1, and return the second user ID # in column 3.
try this formula
=VLOOKUP(B2,A2:C10,3,FALSE)
This formula assumes that your data starts in cell A2 and goes until cell C10. The first argument (B2) is the value you're searching for, which is the first user ID # in column 2. The second argument (A2:C10) is the range that contains the data you want to search in. The third argument (3) is the column number from the range that you want to return a value from. In this case, it's the third column, which contains the second user ID #. The fourth argument (FALSE) specifies that the VLOOKUP function should perform an exact match search.
You can copy this formula down to the rest of the cells in column 3 to auto-fill the second user ID # based on the first.
This formula assumes that there are no duplicates in the first user ID # column (column 2). If there are duplicates, the formula will only return the first match it finds.

Count if a cell is not blank, and matches an adjacent cell

Example table
Column 1
Column 2
First
First
Second
Second
Third
Third
Fourth
Fifth
Fifth
Sixth
So, what I am trying to do is Count all the cells in column 1 that are NOT blank AND match the adjacent cell in Column 2.
In this case, the total count should be 4. How would this formula be written?
=SUMPRODUCT((A2:A7=B2:B7)*(A2:A7<>"")

excel vlookup on condition (2 rows with same lookup value, but one has blank data, other has data)

Hopefully a simple question here, in Sheet 1, each lookup value has 2 rows. One row contains a blank value for Column N, and one row contains a numerical value. I want the vlookup to ONLY pull in the Numerical value, not the blank (it's pulling in the blank now because it's only considering the first value).
Is there a simple way to get this to skip over any row in sheet1 that matches the lookup but returns a blank value?
=IF(A2="""","""",VLOOKUP(A2,'Sheet1'!B:N,10,FALSE))
So as you can see, if we do a generic vlookup, it will just return the first lookup for column B which will return a blank for Column N. We want the row with the value.

How to get nth non-blank column in Excel

I want to use an excel spreadsheet to lottery off a set of items amongst multiple contenders. I made a sheet with a column for the item and one for each contender. On each row, the first column has the items name and each user puts a "y" in his cell if he has interest in that item:
Item -A-B-C-D-E-F-G-
Foo - -Y- -Y- -Y- -
Bar -Y-Y-Y- - - - -
Roll -Y- -Y-Y- - -Y-
I then added a column which counted the amount of contenders with a formula like:
COUNTA(Table2[#[A]:[G]])
And another column to choose a random number amongst the contenders with a formula like:
=CEILING.MATH( RAND()*[Amount of contenders cell])
The issue is: Once I have the index of the contender who won, how can I display the name of the winning contender based on the index of which Y was selected?
I solved this by making another table right next to the first table with a column for each contender. The value of each cell = how many "Y" (or non-blank cells) occur upto and including the current contender. The formula for each cell is:
The first column simply is equal to if the corresponding cell is blank: 0 otherwise: 1
=IF(ISBLANK(Table2[#A]),0,1)
And the subsequent columns equal to the previous column + the formula above:
=IF(ISBLANK(Table2[#B]),0,1)+K2
I now have a soon-to-be-hidden table corresponding my original table which looks like this;
A-B-C-D-E-F-G
0-1-1-2-2-3-3
1-2-3-3-3-3-3
1-1-2-3-3-3-4
Once I have this table, I can successfully use match and index to get the name of the 3rd contender for the given row. First I get the absolute index of the n-th non-blank column (the last parameter: 0 indicates that I want an exact match, which gives me the first occurrence of "n" in my helper-table for that row:
=MATCH(Table2[#[Snapshot of lottery results]],K2:P2,0)
And then using that index, I can get the name of the winning contestant (where B1:H1 contains the column names and the cell at column J:current row contains the decision index:
=INDEX($B$1:$H$1,1,IF(J2>0,J2,""))

VLOOKUP and Record Count Excel

Two spreadsheets: Spreadsheet 1 and Spreadsheet 2
I am trying to find out which records in spreadsheet 1 exist in spreadsheet 2 (Currently basing it off a single column)
I am doing a v look up to match two columns of data. After the match, I want to do a record count to count how many of the same matches it found (displayed in another column)
Here is a my vlookup formula
=VLOOKUP('[Spreadsheet1.xlsx]Complete'!$B:$B,Y:Y,1,FALSE)
If I understand your question, for each row in Spreadsheet 1 you want to return the number of times the key of Spreadsheet 1 appears in Spreadsheet 2. This will give you how many times what's in cell B1 appears in column Y:Y:
=COUNTIF('[Spreadsheet2.xlsx]Complete'!$Y:$Y, $B1)
I'm assuming you're attempting to determine whether or not some unique value like an ID exists in both Spreadsheets 1 and 2. What I would do is add a column to both to check the other for the existence of the value with something like this:
For Spreadsheet 1
=IF(ISERROR(MATCH(B1, '[Spreadsheet2.xlsx]Complete'!$B:$B, 0)),"",1)
For Spreadsheet 2
=IF(ISERROR(MATCH(B1, '[Spreadsheet1.xlsx]Complete'!$B:$B, 0)),"",1)
For the MATCH function, if there is a match it returns the row number of the match, if there is no match it returns an error. This formula will add a 1 to the column if there is a match and leave the cell blank if there is no match. Take the sum of this new column get a match count in each sheet.

Resources