Compare columns in two sheets - excel

I have two sheets in Excel that I am trying to compare. This is a bit convoluted so I hope my explanation is clear.
Sheet 1 is named 'mapping and Sheet 2 is named SOA
I would like to compare column D in 'mapping' to column A in 'SOA'
Where the value in column D of mapping is equal to the result in column A of 'SOA' I would like to enter the corresponding text info from column B of SOA into column E (which is blank) in 'mapping'
Column A in SOA is in ascending order while column D is not, and cannot be.
A sample for the data is:
Sheet 1 (Mapping)
A B C D E
A1.3
A1.1
A1.2
Sheet 2 (SOA)
A B C D E
A1.1 YES
A1.2 MAYBE
A1.3 NO
A1.4 IDK
The result I am looking for would give me:
Sheet 1 (Mapping)
A B C D E
A1.3 NO
A1.1 YES
A1.2 MAYBE
I have tried the following formulas but have not gotten any luck
=IF(COUNTIFS(('mapping'!D3:D466),=SOA!A4:A136",SOA!B4,""))
=IF('mapping'!$D3:$D466=SOA!$A4:$A136,SOA!$B4:$B136,"")

Thanks everyone, I got it working with a combo of all of this. Some of the issue was the nature of the data I receive

Related

VLOOKUP issue in Excel

I have the following basic VLOOKUP setup, having not used Excel in anger for a while. I am looking up the values a, b and C in a table containing two columns.
<value returned> <expected>
a 1 b =VLOOKUP(A1,C$1:D$1,1,FALSE) #N/A #N/A
b 2 c =VLOOKUP(A2,C$2:D$2,1,FALSE) #N/A 2
c 3 d =VLOOKUP(A3,C$3:D$3,1,FALSE) #N/A 3
I am getting #N/A returned for all rows (as shown to the right), but I would expect the values to the right again to be returned. Can someone please explain what I have done wrong?
Thanks
If you still stick to dataset :
a 1 b
b 2 c
c 3 d
then : =INDEX($C$2:$C$4,MATCH(A1,$D$1:$D$3,0))
So if you re-arrange the data as :
a 2 b
b 3 c
c 4 d
then use : =INDEX($C$1:$C$3,MATCH(A1,$D$1:$D$3,0))
hope that helps. (:
When using VLOOKUP, the column containing the key to be matched has to be the first column on the left of the range. So change your data layout to this:
A B C D
a b 1
b c 2
c d 3
and use the following formula:
=VLOOKUP(A1, C$1:D$3, 2, FALSE)
and then it should work. As #Scott mentioned in his comment, if you want to keep your data layout the same, you could look into using INDEX.

Vlookup among different workbook and sheets and update value

I have two different workbooks. One is the master file and the other workbook is Workbook2 which has different worksheets. I need to look into the master file into column A, column E and column F. If the value from Column A and Column F is found in any of the sheets in Workbook2 then the last column in the sheets will be populated with column E from the master file. Column A and Column F from the master file is found in Column B and Column C in Workbook2. Any help is highly appreciated!!
MasterFile
A B C D E F
Yahoo 009 899 777 Spoke to client INV# 123
WorkBook2 --Expected Results Column Q
SHEET1
A B C D E F Q
ID123 Google INV# 345 89 XX 333
SHEET2 --The result was found therefore column Q is populated with Column E from
the master file.
A B C D E F Q
ID009 Yahoo INV#123 777 444 223 **Spoke to client**
SHEET3
A B C D E F Q
ID456 MICROSOFT INV#000 676 989 123
Actually you are trying to use excel as a database, which IMHO is not a good idea. Although one solution might be this. But even then it will not work, because the data in the MasterFile is incompatible with the data in SHEET2: INV# 123 is not equal to INV#123. So it will never give a result.
If you manage to get correct data, then try this:
Insert an extra column at the beginning of the MasterFile and populate it with (the original columns A and F have now shifted to B and G)
=B1&G1
Now add a VLOOKUP formula in SHEET2
=VLOOKUP(B1&C1,[Masterfile.xlsx]Sheet1!$A:$G,6,FALSE)
Another option might be put the masterfile in a database table and use a SQL query to get the data. Something like:
SELECT m.E FROM MasterFile m WHERE SHEET2.B = m.A AND SHEET2.C = m.F
There might be some errors in the SQL syntax, but I hope you get the idea.

How to remove rows in Excel where inclusions are not met?

For example, say I have two columns:
ID, Code
1 A
1 B
1 G
2 A
2 F
3 A
3 B
3 C
3 F
4 B
I want to delete any rows for which the ID number is not associated with both A and B somewhere.
So for example all the rows with ID=1 are OK to keep because it is associated with code A and code B.
All rows with ID=2 are to be deleted because it has A, but no B.
All rows with ID=3 are OK because it has both A and B.
All rows with ID=4 are to be deleted because it only has B, no A.
The real file has many rows so I can't do this by hand. Is there a quicker way? I tried using Vlookups somehow but I can't find a way to easily tell which ones to delete.
Using COUNTIFS:
=COUNTIFS(A:A,A1,B:B,"A")+COUNTIFS(A:A,A1,B:B,"B")
Delete all the results that returns 0 or 1 (and keep all the results that give 2).
using 2 temporary helper columns in C & D
1st column = A2 & B2, copied down
2nd column =IF( OR( ISERROR(Vlookup(A2 & "A",C:C,1,FALSE)),ISERROR(Vlookup(A2 & "A",C:C,1,FALSE))),"DeleteMe","SaveMe")
Follow Instructions in column D
Delete Columns C & D
Don't forget to try this on a backup first, so you can enure it works to your satisfaction

Microsoft Excel Referencing data

I am trying to figure out how to look up a cell to see if it contains a name from a list I have specified, we will use "Hofmann Trucking" for example.
Using columns a,b and c where column a contains average hours it takes for truck to travel from point a to point b, column b contains the carrier information (Hofmann Trucking) and finally column c which is where I would like the answer to go.
I want column c to return the time listed in column a, only if Hofmann trucking is the carrier in column b. If another carrier is listed I would like to put that information in column d.
In the end these times will be averaged per carrier per day so I can easily show how much time is spent traveling to and from certain areas by different companies.
This should do it:
Col A Col B Col C Col D
8 Hoffman Trucking =If(B1="Hoffman Trucking",A1,0) =A1-C1
Put those 2 formulas in columns C & D and drag down...

Excel - countif()

i am having troubles with the excel function Countif.
I got 2 columns A and B and they should contain (almost) the same entries - which is what i am testing for and i need to know which entries are different. Order does not matter.
columns are actually tickers and look like this
http://pastebin.com/zHdJ5ndp
ok, so i use countif to identify the entries of column B which are not in column A.
Countif(A:A;B1)
Countif(A:A;B2)
...
The result is a column full of zeros, which is just not correct.
other simple tests like
a a 1
b b 1
c c 1
d d 1
e e 1
f f 1
g g 2
g h 0
work just fine!
What am I doing wrong right here?
Thanks in advance!
Are you sure the data in column A and B is the same (no extra space etc)?

Resources