I have two tables like below, I need to extract common entry between the 2 tables and put this in a 3rd table.
Table 1 Table2 Table 3
A A A
B X B
C B C
D Z
E C
Is there a way to do this in Excel?
Try
=IF(ISNUMBER(MATCH(A2,$C$2:$C$6,0)),A2,"")
copy down.
Related
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.
i am new to vba, i have a requirement in one of the report i need to generate
for example
A B C D E
R1 1,2,3 A,B,C Q,W,E 1
Once I run a macro it should show like below:
R1 1 A Q 1
R1 2 B W 1
R1 3 C E 1
this is a just a sample data, my excel has A - AO columns and almost 10,000 records
Please advice
One way you could do this without external tools is to use the Split function, which retuns an array of strings.
You could split each column and then add rows based on the same index, if that is what you need, or add rows based on all possible combinations.
I'm trying to rearrange a pivot table that organizes all values (not sum or other statistic) from an original table. Seems simple but I can't find a way to make it values rather than sums.
My original data looks like:
Rank Name
1 A
1 B
2 C
2 D
3 E
3 F
and with the pivot table I get something like:
Rank Name
1 A
B
2 C
D
3 E
F
and I would like to rearrange it like so:
1 2 3
A C E
B D F
There's a way to achieve that using array functions instead of pivot tables.
Suppose your original data is located in A1:B7.
To get the headers row (1, 2, 3):
A10: =MIN(A2:A7)
B10: =SMALL($A$2:$A$7,COUNTIF($A$2:$A$7,"<="&A10)+1)
Then copy B10 as far right as you need to get all other values
To get the values for each rank, set an array formula (Ctrl+Shift+Enter) on the range A11:A16 (or lower to fit more items) with this formula:
=IFERROR(INDEX($B$2:$B$7,SMALL(IF($A$2:$A$7=A$10,ROW($A$2:$A$7)-ROW($A$2)+1),ROW()-ROW(A$10))),"")
Then copy this range (A11:A16) as far right as you need...
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
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