return multiple different values based on 2 criteria in excel - excel

Hope you can help. I have 2 excel sheets that look like this:
Sheet1:
ID trnx Module
1 aj08 AA
2 aj08 AA
3 aj08 AA
1 CJ20 ps opex
1 CJ20 ps capex
2 cn22 HR
Sheet 2
ID trnx Module
1 aj08
2 aj08
1 ml81
3 aj08
2 cn22
1 cj20
1 cj20
3 mm02
The formula im using is
INDEX($G$2:$G$9,SMALL(IF(A2=$F$2:$F$9,ROW($F$2:$F$9)-MIN(ROW($F$2:$F$9))+1,"")&IF(C2=$H$2:$H$9,ROW($H$2:$H$9)-MIN(ROW($H$2:$H$9))+1,""),COUNTIF(A$2:A$2,A2)&COUNTIF(C$2:C$2,C2)))
I need "module" from sheet 2 to be populated based on matching ID and trnx, and if the ID matches but not the trnx, then it must that cell for module to "No Match".
The problem i am experiencing is that sheet 2 is populating the data incorrectly. For Example the second occurrence of ID "1" in sheet 2 is pulling out Module ps opex. it is suppose to be "No Match" since the trnx in sheet 2 is ml81.
please help!!! Thanks in advance:)

This won't address the part I asked in my comment where you have 'duplicate keys' but may help you anyway :
Since your key is really the combination of the Id and the trnx columns, I inserted a concatenated column (I used =CONCATENATE(trnx, "_", id) where those names refer to sheet locations, but you could just as readily concatenate in the other direction as well, or use some other delimiter. It's just to make a single key column (that we can sort on and search more easily.)
In sheet 2 I form the same key column from the values listed there, and then your module column becomes :
=IF(ISNA(VLOOKUP(I12,$C$10:$D$15,2,0)), "No Match", VLOOKUP(I12,$C$10:$D$15,2,0))
Where in that formula, I12 is the key cell we are looking up in sheet 2, and the absolute reference in the VLOOKUP is the data table in sheet 1.

Related

match two columns in seperate sheets and add other two columns

I have 2 excel spreadsheets in a single excel file. Both of these files have a Campaign Name column and sum_revenues column
My first problem is that I want to match the Campaign Name column in both the sheets and if they match then I want to add the sum_revenues value in the 1st spreadsheet to sum_revenues in the 2nd spreadsheet
I know that sumif or sumifs will be used but I do not know how I can apply them.
The output should be the addition of sum_revenues column in both the sheets based on the Campaign name matching criteria in the sum_final column which is present on the 2nd sheet.
I hope I am clear about the question but please let me know if there is any confusion.
Below is how sheet 1, Sheet 2 looks like.
Sheet 1:
Campaign Name sum_revenues
ABC 40
DEF 60
Sheet 2:
Campaign Name sum_revenues sum_final
ABC 30 70
GHI 10 0
Now please note that in Sheet 2 in which I want to output is that sum_final column has the sum_revenues added up from both the sheets because ABC is present in both the sheets and it should show 0 for those which do not match.
Try:
=IFERROR(VLOOKUP(A2,Sheet1!$A$2:$B$3,2,FALSE),0)+B2
Sheet 2 Images:
Below formula may help you, assuming that your sheet1 data available in column A & B and sheet 2 data available in Column D & E and finally F would be the result.
Type the formula
sumif(e:e,d:d,a:a)+sumif(a:a,d:d,b:b) +e3

copy values of a column from one sheet to another sheet based on value of first column [duplicate]

This question already has answers here:
Remove #N/A in vlookup result
(4 answers)
Closed 4 years ago.
This is my first excel task and I am a bit lost. Here are my sheets:
sheet1
name product_id
ABC
DEF
ERG
ZYT
sheet2
name product_id
ABC 1
DEF 2
WRT 8
ERG 9
Now what i want is for sheet product_id field to be filled in based on name field of the sheets. E.g. ABC is 1 in sheet 2 and in sheet 1, i need it to become 1 also. The number of rows differ (sheet 1 is shorter) and any not found names in sheet 1 should be ignored. In the end, I need sheet 1:
sheet1
name product_id
ABC 1
DEF 2
ERG 9
ZYT
Since ERG and ZYT are not found in sheet 2, they should be ignored. The order of the names could be different so I am looking for away to scan/loop and replace, if i am making any sense.
I have seen this https://www.extendoffice.com/documents/excel/4112-excel-copy-column-based-on-cell-value.html but it keeps on saying formula incorrect.
I am not familiar with VBA so it would be nice if it can be done using simple excel formulas.
Update:
following the suggested answer, i did come close but somehow rows are skipped if A column (searched column) don't match
You can do this with a VLOOKUP. This goes in your sheet 1 in cell B2, then drop this down to your last cell
=IFERROR(VLOOKUP(A1,Sheet2!A:B,2,0),””)
If it does not find your value it will return “”. You can put anything inside the quotes if you want it to show something else, like maybe “Stack Overflow is Awesome”

Formula to dynamically create column of values, excluding some by criteria

Say I have a column with these values on Sheet1:
IDs
1
2
3
4
5
6
Then a column with these values on Sheet2:
Used IDs
2
3
6
Is there a clever way I can write a formula on Sheet3 that shows only the IDs that are visible on Sheet1 but NOT on sheet2? Like this:
Unused IDs
1
4
5
I need something that would update dynamically as move values are added to the
Used IDs' column on Sheet2. I can make something work that simply omits the used IDs (retaining their rows as NULL), like this:
Unused IDs
1
4
5
However, I need something without the blank rows.
put this in A1 in Sheet3 and copy down till blanks:
=IFERROR(INDEX(Sheet1!A:A,AGGREGATE(15,6,ROW(Sheet1!$A$1:$A$6)/(NOT(ISNUMBER(MATCH(Sheet1!$A$1:$A$6,Sheet2!A:A,0)))),ROW(1:1))),"")

need to copy data from one sheet to another depending on a value of the first sheet

i have never used excel except for in college and well that was a while ago, what i have is 3 sheets sheet 1 contains all user information sheet 2 is company information and sheet 3 is company member information,
now what i need to do is this,
i need to loop through sheet 1 column K and search for what is not "Individual" then i need the value of sheet 1 column A and put that in sheet 3 column C
i also need the index of the same row that does not equal "Individual" and use that to grab the value of sheet 2 column A and put that in sheet 3 column B
hopefully that makes sense and is actually possible and any ideas would be greatly appreciated!

Format Cells from 2 sheets, based on 4 column comparison

I need to find changed values in dataSet.
So I have 2 sheets with, in general, same data.
I have two columns: docID(which is unique key) and rev(which is not unique).
I need to find(highlight/display only/...) those rows, where for same docID from first sheet rev is different in the second sheet.
UPDATE 1
Sheet 1:
docID rev
1 5
2 6
3 1
Sheet 2:
docID rev
1 6
2 6
3 1
Only the first row makes an interest to me, as others did not changed.
UPDATE 2
simple if statement which should give some understanding what I need. In general this is done on similar test data set, so cells are incorrect.
=IF(NOT(AND($B6=Sheet1!$B6;$C6=Sheet1!$C6));1;0)
So values are NOT equal.
You can do this with a custom formula in Conditional Highlighting:
Select the top cell in the column docID column, then select the whole column (in the example, I assume that this is column A and you select A1 and the rev is in column B, same structure in both sheets. Adjust as to your needs)
Goto home->Conditional Formatting->New rules->Use formula to determine which cells to format and enter the following formula:
=VLOKUP(A1,Sheet1!$A:$B,2,0)<>B1
Click on format and select the format you need.
Done!

Resources