Vlookup doesn't work with column of string - excel

I have 4 columns, containing 2 columns of names and 2 columns of values, as below. I need to update Column B with value in K, if the name1 = name2. Both name columns are formatted as text, and values columns are formatted as numeric.
(A) Name1 (B) Value1 (J) Name2 (K) Value2
A A 123
B B 456
C X 000
D Y 000
E Z 000
F C 789
I insterted the following vlookup in the first row of column B, but it returns the name in column A.
=VLOOKUP(A4,J2:J22890,K2:K22890)
I'm expecting to have the following result:
(A) Name1 (B) Value1 (J) Name2 (K) Value2
A 123 A 123
B 456 X 000
C 789 B 456
D Y 000
E Z 000
F C 789
Am I using vlookup a the wrong way? or is it due to the fact that I'm looking up strings??

I think it should be
=VLOOKUP(A4,J2:K22890,2,0)
1.First parameter is the value you are looking for,
2.second one is the range (it can be multiple columns, with the referenced data in the most-left column of the selection),
3.followed by the column's number where the records should be retrieved from,
4.and lastly a flag (1 or 0) if you would like to accept similar results (1) or exact matches only (0)

Since I can't edit the post because it's not enough characters and I can't comment because I don't have enough rep...
=VLOOKUP(A4,$J$2:$K$22890,2,0)
This is Alex's post with absolute references for the lookup table array.

Related

Need help inputting data in excel columns from other columns

If I had data in rows A to E as seen below in the table. Some of the values can be NA. IN column F if i wanted to input data from columns A to E in a way that if data in A exists use that otherwise if data in B exists use that otherwise until column E. If none of them have any values return NA. I would like to automate this where somewhere I just specify the order for example A, B, C, D and E OR A, C, E, D, B and the values in F update according to the reference table
Reference : C - B - A - E - D
a
b
c
d
e
f
3
4
3
2
2
7
1
7
NA
1
4
2
4
2
2
4
2
2
Use FILTER() with # operator.
=#FILTER(A2:E2,A2:E2<>"","NA")
For dynamic array approach (spill results automatically), try-
=BYROW(A2:E7,LAMBDA(x,INDEX(FILTER(x,x<>"","NA"),1,1)))

Compare two columns and get the values from another column?

I have an excel table with multiple columns, I need to add value for every transaction_id, how can i compare column C with column J and enter values from K into D column?
Table looks like this:
C
D
J
K
transaction_id
amount
transaction_id
amount
1
5
1000
2
1
1000
5
118
200
118
117
500
I need to match the exact transaction_id and move from the right to left amount value if transaction id is the same, how can I do that?
Just use VLOOKUP:
Formula in D is:
=VLOOKUP(C2,$J$2:$K$5,2,FALSE)

Excel or VBA - VLOOKUP with IF Coniditon

Hi,
I would like to investigate a huge list that I can distinguish the Acc numbers according to the mail adresses. The things that I
would like to do if email adresses has a seperate Acc and if they
equal each other( I mean if Acc numbers are equal),write a "equal" if
the criterias were not equal with the same email then write a
"multiple criteria"..
Is there any way to do that with Excel formulas or VBA ?
Mail Acc
uralsmh#gmail.com C1234
uralsmh#gmail.com C2345
Part 1 - check for duplicates
Create a helper column that sticks columns A and B together and then count this column. You can use the & character for this:
A B C D
1 abc 123 =A1&B1 =COUNTIF($C$1:$C$1000,C1)
2 abc 123 =A2&C2 =COUNTIF($C$1:$C$1000,C2)
3 def 123 =A3&C3 =COUNTIF($C$1:$C$1000,C3)
If you get a number greater than 1 in column D, then that row is a duplicate of another row.
Part 2 - find multiple accounts
Now you have found the exact duplicates, any email addresses that match must have different account numbers. So, in column E, just count column A:
A B C D E
1 abc 123 =A1&B1 =COUNTIF($C$1:$C$1000,C1) =COUNTIF($A$1:$A$1000,A1)
2 abc 123 =A2&C2 =COUNTIF($C$1:$C$1000,C2) =COUNTIF($A$1:$A$1000,A2)
3 def 123 =A3&C3 =COUNTIF($C$1:$C$1000,C3) =COUNTIF($A$1:$A$1000,A3)
If you get a number greater than 1 in column E and you had a 1 in column D, you have found an email address with multiple accounts.

Excel, IF and COUNT duplicates

So here it is,
Column A has duplicate and unique number values, Column B has duplicate and unique Strings (Names). I need to count the instances of unique number values in A matched to their name in B.
So it would be like =COUNTIF(B1:B100,"XYZ") "Then counts all unique number values in A1:A100 that "match" or have XYZ in column B.
Col A - Col B
ABC - 963
ABC - 963
FFF - 367
FFF - 367
FFF - 234
XYZ - 678
XYZ - 221
XYZ - 334
What I need:
ABC = 1 ( one unique instance where Col A and Col B (ABC,963) )
XYZ = 3 ( three unique instances (XYZ,678 : XYZ,221 : XYZ,334
FFF = 2 ( two unique instances ( FFF,367 and FFF, 234 )
So I need to sum up all the unique instances of Column A that only match the strings in column B.
Thanks in advance !, I'll keep searching in the meantime !
I believe that you are looking to retrieve a count of the unique combinations of number and name. Perhaps something like the following.
        
The formula in E2 is,
=SUMPRODUCT((A$2:A$99<>"")/COUNTIFS(B$2:B$99, B$2:B$99&"", A$2:A$99, A$2:A$99&""))
The formula in E4 is,
=SUMPRODUCT((A$2:A$99=D4)/COUNTIFS(B$2:B$99, B$2:B$99&"", A$2:A$99, A$2:A$99&""))
Fill E4 down as necessary.

How to align and merge matching values, from various columns, in excel

I have had some success matching data from various columns and creating a new data output. Here is what I typically start with;
COL A COL B COL C COL D
ITEM VALUE ITEM VALUE2
---- ---- ---- ----
A 1 B 100
B 2 A 200
C 3 F 300
G 4 E 400
H 5 C 500
J 6 M 600
And I can achieve this result using VLOOKUP;
COL E COL F COL G
ITEM VALUE VALUE2
---- ---- ----
A 1 200
B 2 100
C 3 500
G 4
H 5
J 6
But what I'm really after is this: both matching AND merging;
COL E COL F COL G
ITEM VALUE VALUE2
---- ---- ----
A 1 200
B 2 100
C 3 500
E 400
F 300
G 4
H 5
J 6
M 600
I'm punching a tad above my weight class with this one, so any help would be greatly appreciated.
With something like:
=COUNTIF(A:A,C2)
in a column and copied down you should get indication of which items are not already present in ColumnA. Sort with C:D on that basis and simply copy the items associated with 0 to ColumnA and their values to ColumnD, then sort and apply your VLOOKUP.
The following is based on: http://www.get-digital-help.com/2009/05/25/create-a-drop-down-list-containing-only-unique-distinct-alphabetically-sorted-text-values-using-excel-array-formula/#comment-74005
It's a great site for clever use of Excel formulas and does a good job of explaining the monster formulas below, creating dynamic named ranges, and how to work with array formulas. Look at it!
My solution is not quite as elegant as I'd like but it works. So, you'll need to create some named ranges.
One for the items in COL A (e.g. "Items1") and one for the items in COL C (e.g. "Items2")
In COL G we'll have another List "AllItems1". In COL H we'll have another List "AllItems2". You'll need to make a named range of "AllItems1" too.
The array formula in COL G is:
=IFERROR(IFERROR(INDEX(Items1,MATCH(0,IF(MAX(NOT(COUNTIF($G$1:$G1,Items1))* COUNTIF(Items1,">"&Items1)+1))=(COUNTIF(Items1,">"&Items1)+1),0,1),0)),INDEX(Items2,MATCH(0,IF(MAX(NOT(COUNTIF($G$1:$G1,Items2))*(COUNTIF(Items2,">"&Items2)+1))=(COUNTIF(Items2,">"&Items2)+1),0,1),0))),"")
Which is a mouthful. This cascades through each list (i.e. Items1 and Items2) and gives you a non-repetitive sorta alphabetized list of the items in "Items1" and "Items2".
COL G is really just an intermediate step to get us to COL H. I haven't found a way to combine two lists without doing this step. Let me know if you find a better way.
To get a non-repetitive AND alphabetized list of the items we put the following array formula in COL H:
=IFERROR(INDEX(AllItems1,MATCH(0,IF(MAX(NOT(COUNTIF($H$1:$H1,AllItems1))*(COUNTIF(AllItems1,">"&AllItems1)+1))=(COUNTIF(AllItems1,">"&AllItems1)+1),0,1),0)),"")
Then we do VLOOKUP s off of "AllItems2".
Put the following VLOOKUP in COL I :
=IFERROR(VLOOKUP($H2,$A$2:$B$7,2,0),"")
And put the following VLOOKUP in COL J:
=IFERROR(VLOOKUP($H2,$C$2:$D$7,2,0),"")
Of course, you could make "AllItems2" a named range also and use that in the VLOOKUP s.
I think that gets you what you want.

Resources