VLOOKUP together with MATCH - excel

I have the below lookup condition but can't seem to get it working.
=VLOOKUP(A1,'Raw Data'!A1:A3,MATCH('Submitted Data'!B1,'Submitted Data'!A1:B1))
I'm trying to pull in the B column value from Submitted Data into the B column in Raw Data based of a match on A columns, I just keep getting an error.
Raw Data
A B C
1 L1 23
2 L2 17
3 L7 31
Submitted Data
A B
1 L1 Complete
2 L7 Pending
3 L2 Complete

vlookup does the match for you so you don't need that function. This should work for you:
=VLOOKUP(A1, 'Submitted Data'!A1:B3,2,FALSE)
Where
A1 is the cell with the value you want to find in a different range of cells (i.e, the data on the other sheet.
Submitted Data'!A1:B3 is the range of cells containing the data you want to find your A1 in, and then return the value that's a defined number of columns away from it (see the next sentence).
2 is the column from the range Submitted Data'!A1:B3 (i.e. column B) that has the value you want to return.
FALSE means you want an exact match for your A1 value.

Related

String compare value and pull exact value of cells from other columns and copy to new cell

I am trying to make a statistics table for a set of data and would like a formula that would find exact matches in string values in a particular column and pull the data from another column of that row if there is a match.
Basically, if "Name_1" appears in column X, copy the value of column Z from that row and paste it to a new cell.
=IF(AND(Data!N:N,"*Name_1*",Data!O:O,"*HE*"),
VLOOKUP(AND(Data!N:N,"*Name_1*"),Table2,15,FALSE))
I have multiple conditions that I would like the formula to check first before pulling the data.
If the cell in column N contains the name & if column O contains "HE" THEN,
copy value of cells found in column O (without repetition).
EDIT:
I am keeping track of the number of times (for example), CH appears in column N and the string value of the cell in the next column O. So I have a counter that counts every time CH appears - and the type of human error that has occurred (which is data in Column O).
Example of expected output:
USERS
ERROR TYPE
CH
HE1
KL,LT
HE3
CH
ABC
CH, KL, LT
HE1,HE2
Here, total count for CH is 3, with 2 involving HE1 and HE2 and 1 involving ABC (based on example).
Count for KL is 2 involving HE1, HE2 and HE3
Count for LT is 2 involving HE1, HE2 and HE3.

Formula to get crossed values

I am trying to get values from other column, based on some logic, crossed logic, but I didn't get any result with the only thing I know: IF or VLOOKUP.
The table is in this way:
So basically there are groups divided by blank row, and in column D I want to add the value from column B, but according with other letter that the one from the row ( C is from Credit, D is from Debtor). So in first D5 I have C on the same row in A5, so I need to take value from D, which is 2, according to B6.
So sorry if this question is too easy or stupid, but I don't know much about excel formulas, other that the basic one.
I'd say the fastest way with formula takes two columns. The first one (let's say column C) will use this formula to define the blocks:
=IF(A5="",C4+1,IFERROR(C4+0,0))
It's meant for cell C5.
The second column will give back the actual result:
=SUMIFS(B:B,A:A,IF(A5="C","D",IF(A5="D","C","")),C:C,C5)
It's meant for cell D5.
Place them accordingly and drag them down to cover your list.
Then again: if you are looking just for the number and not for its sum (and therefore assuming all numbers are equal for each letter in each block), just use this one in cell D5 instead of the previous one:
=SUMIFS(B:B,A:A,IF(A5="C","D",IF(A5="D","C","")),C:C,C5)/COUNTIFS(A:A,IF(A5="C","D",IF(A5="D","C","")),C:C,C5)
Now if you were to use only IF and VLOOKUP functions, a possible solution could be this one:
A
B
C
D
E
F
G
Block index
0
What to search
What is
Value
Result
C
1
=IF(A5="",C4+1,C4)
=IF(A5="",C4+1,C4)&SE(A5="C","D",SE(A5="D","C",""))
=C5&A5
=B5
=IF(VLOOKUP(D5,E:F,2,FALSO)=0,"",VLOOKUP(D5,E:F,2,FALSO))
D
2
=IF(A6="",C5+1,C5)
=IF(A6="",C5+1,C5)&SE(A6="C","D",SE(A6="D","C",""))
=C6&A6
=B6
=IF(VLOOKUP(D6,E:F,2,FALSO)=0,"",VLOOKUP(D6,E:F,2,FALSO))
D
2
=IF(A7="",C6+1,C6)
=IF(A7="",C6+1,C6)&SE(A7="C","D",SE(A7="D","C",""))
=C7&A7
=B7
=IF(VLOOKUP(D7,E:F,2,FALSO)=0,"",VLOOKUP(D7,E:F,2,FALSO))
=IF(A8="",C7+1,C7)
=IF(A8="",C7+1,C7)&SE(A8="C","D",SE(A8="D","C",""))
=C8&A8
=B8
=IF(VLOOKUP(D8,E:F,2,FALSO)=0,"",VLOOKUP(D8,E:F,2,FALSO))
D
3
=IF(A9="",C8+1,C8)
=IF(A9="",C8+1,C8)&SE(A9="C","D",SE(A9="D","C",""))
=C9&A9
=B9
=IF(VLOOKUP(D9,E:F,2,FALSO)=0,"",VLOOKUP(D9,E:F,2,FALSO))
C
4
=IF(A10="",C9+1,C9)
=IF(A10="",C9+1,C9)&SE(A10="C","D",SE(A10="D","C",""))
=C10&A10
=B10
=IF(VLOOKUP(D10,E:F,2,FALSO)=0,"",VLOOKUP(D10,E:F,2,FALSO))
=IF(A11="",C10+1,C10)
=IF(A11="",C10+1,C10)&SE(A11="C","D",SE(A11="D","C",""))
=C11&A11
=B11
=IF(VLOOKUP(D11,E:F,2,FALSO)=0,"",VLOOKUP(D11,E:F,2,FALSO))
D
2
=IF(A12="",C11+1,C11)
=IF(A12="",C11+1,C11)&SE(A12="C","D",SE(A12="D","C",""))
=C12&A12
=B12
=IF(VLOOKUP(D12,E:F,2,FALSO)=0,"",VLOOKUP(D12,E:F,2,FALSO))
C
5
=IF(A13="",C12+1,C12)
=IF(A13="",C12+1,C12)&SE(A13="C","D",SE(A13="D","C",""))
=C13&A13
=B13
=IF(VLOOKUP(D13,E:F,2,FALSO)=0,"",VLOOKUP(D13,E:F,2,FALSO))
C
5
=IF(A14="",C13+1,C13)
=IF(A14="",C13+1,C13)&SE(A14="C","D",SE(A14="D","C",""))
=C14&A14
=B14
=IF(VLOOKUP(D14,E:F,2,FALSO)=0,"",VLOOKUP(D14,E:F,2,FALSO))

Returning a result ONLY for unique criteria, with multiple criteria. OFFSET(), FREQUENCY(), SUMIF()

Here is an overview of what I am trying to do.
i have 6 columns
A is alphanumerical
B is text
C,D are binary data
E is text
F is the column I want to populate with binary data
To simplify I would like to test columns B,C,D,E against a set of criteria (each column has its own set of criteria to test against). If all B,C,D, and E are "true" I want to return a "1" in column F.
Now here comes the problem I'm having.
Basically A is an ID#, and B,C,D,E are criteria each must met to return a "1" in column F. The problem is that there are multiple rows of each ID#. It doesn't matter which ID# instance, but I only want to return ONE "1" in column F for each unique ID#.
Once a 1 is returned for a particular ID#, I don't need it to actually check the remainder of the same ID# rows, it can move on to the next ID# if need be.
I'm returning a "1" for the simplicity of the question, but eventually I want to have multiple criteria sets, and return a letter corresponding to each set instead of a "1".
Ex/
Row 1 A="1D45", B=true, C=false, D=true, E=true -- Returns F="0"
Row 2 A="1D45", B=true, C=false, D=true, E=false -- Returns F="0"
Row 3 A="1D45", B=true, C=true, D=true, E=true -- Returns F="1"
Row 4 A="1D45", B=true, C=true, D=true, E=true -- Returns F="1", BUT i want it to show 0
Row 5 A="1D45", B=true, C=false, D=true, E=false -- Returns F="0"
Row 6 A="1D45", B=true, C=true, D=true, E=true -- Returns F="1", BUT i want it to show 0
Row 7 A="1D46", B=true, C=true, D=true, E=true -- Returns F="1"
etc. etc.
Thanks a bunch
Your formulas are:
F1:
=--AND(B1,C1,D1,E1)
F2:
=AND(B2,C2,D2,E2)*(0=COUNTIFS(A$1:A1,A2,F$1:F1,1))
Fill down column F from F2.
In the first AND, you can replace B2 and C2 etc with your actual conditions. The last condition is actually what checks that this ID in column A has not yet got a value of 1 in column F above it.

How to select certain rows in Excel that meet logical criteria of A & B

I have an excel sheet in CSV that has 8 columns A-H and thousands of rows with values 0 or 1 depending on truth value.
I'm looking for the Excel function in which I can select rows where column A and B are true so that I can check another columns probability given A&B. IE P((A&B)|D) (where | means given).
I'm really new to excel and having difficulties finding how to only select rows that meet this criteria.
The following formula entered in I1 will return a 1 if both A1 and B1 are true.
=IF(AND($A1=1,$B1=1),1,0)
Copy it down or autofill to identify all rows where A and B are true.
The $ sign before A and B make the column references absolute meaning if you drag the formula to the right, the references to columns A and B will remain.
Because Excel implicitly interprets 0 = FALSE and 1 (or any other number) = TRUE the formula could be shortened to:
=IF(AND($A1,$B1),1,0)
The probability of C being 1 given that A and B are 1 can be calculated by counting all rows where A, B and C are all 1 and dividing by the number of rows where both A and B are 1:
=COUNTIFS($A:$A,"1",$B:$B,"1",C:C,"1")/COUNTIFS($A:$A,"1",$B:$B,"1")
Again, references to A and B are absolute, while C is relative so you can drag right to get probabilities for columns D to H.
COUNTIFS only counts the rows where all of the criteria are met and allows you to specify up to 127 range/criteria pairs.
EDIT
You could also use:
=AVERAGEIFS(C:C,$A:$A,1,$B:$B,1)
to get the probability.

Excel vlookup with two columns in source and target returning another column

I have a spreadsheet that has 4 columns sheet 1, and 5 columns sheet2 and I need to do a vlookup on Sheet1!a2&c2 and match the row in sheet2!a2&c2 and return sheet2!c5.
I think Index and Match would do it but all the examples have been matching a single value to an array which isn't what I need for eg.
Can't do attachments yet :( text it is sorry for the format
Sheet1
R1 A B C D
R2 2 D 3 Result will match sheet1!a2&c2 to sheet 2!A3&C3 and return Sheet2!e3 ie 34
Sheet2
R1 A B C D E
R2 2 F 5 GR 72
R3 2 X 3 FR 34
Any links or help?
Update
Sorry I wasn't clear I want to match the cobination of A2 and C2 in sheet 1,
ie in the example =sheet1!A2&sheet1!c2=23
to the values in sheet2!a2 plus sheet2!c2,
ie in this example =Sheet2!a3&Sheet2!c3=23,
and then return the value in Sheet2!E? , ie Sheet2!E3=34 here
I've done this before by creating a cheat column in sheet 2 = a2&c2 in say d2 and filling down then using, assuming 3 rows, however I can't create the cheat column in sheet2
=vlookup(a2&c2,sheet2!d2:e3, 2, false)
The rows sheet2! look like, sorry about the formatting
Picture attached, which I suddenly got to do , where I need to match the yellow columns in the lookup then return the brown column to sheet1!E2 but I can't add the cheat column Sheet2!d2:3 to the sheet cause the user is difficult :)
Thanks again. Any good tutorial on Index?
Try using LOOKUP like this
=LOOKUP(2,1/(A2=Sheet2!A$2:A$10)/(C2=Sheet2!C$2:C$10),Sheet2!E$2:E$10)
The two "tests", i.e.
(A2=Sheet2!A$2:A$10)
and
(C2=Sheet2!C$2:C$10)
return "arrays" of TRUE/FALSE values but when you divide 1 by one of those and then the other TRUE is converted to 1 and FALSE to 0 so you get a resulting array of either 1s (where both conditions are TRUE) or errors [#DIV/0!] where one or both are FALSE.
When you lookup 2 in that array it will never be found so it matches with the last 1, i.e. the match is with the last row where both conditions are satisfied...and the corresponding value from Sheet2!E$2:E$10 is returned. Another way is like this:
=INDEX(Sheet2!E$2:E$10,MATCH(1,(A2=Sheet2!A$2:A$10)*(C2=Sheet2!C$2:C$10),0))
which requires "array entry" with CTRL+SHIFT+ENTER

Resources