Excel Conditional Statement to determine which rows to delete and which to keep - excel

I have 2 excel sheets containing data that will help me determine whether or not I need to delete or keep a row. Essentially, the way it works is that I have Column A in both sheets of the data which contains a code and column B of sheet 2 contains either a value of the text "Free". For each code in column A of sheet 1, I want to check if the same code exists in column A of sheet 2, and if so, I want to then look at column B of sheet 2 on that same row, and if it's cell contains "FREE" I would like to delete the entire row in containing that code from sheet 1.
Sheet 1: Sheet 2:
A B C A B C
1234 Data Data 1234 FREE Data
1235 Data Data 1456 Value Data
1547 Data Data 1547 Free Data
1483 Data Data 1247 Value Data
Then we Would get:
Sheet 1: Sheet 2:
A B C *Decision A B C
1234 Data Data Delete 1234 FREE Data
1235 Data Data Keep 1456 Value Data
1547 Data Data Delete 1547 Free Data
1483 Data Data Keep 1247 Value Data
This is what I have tried, but there is an error here I can't figure out. I am assuming I am doing something wrong with the syntax. HS is the name range of column A of sheet 2
=IF((VLOOKUP(A2,HS,1) = A2) and (Vlookup(A2, HS, 2) = "FREE"), "delete", "keep")

Try with below formula. It will work
=IF(ISNA(MATCH(A1,Sheet2!A:A,0))=FALSE,"Delete","Keep")
Proof of Work
EDIT #1
As per the request, please see the sheet 2 formula
=IF(ISNA(MATCH(A1,Sheet1!A:A,0))=FALSE,"Delete","Keep")

Your AND is in the wrong place. It should start the multiple conditions and each condition needs to be separated by a comma:
=IF(AND((VLOOKUP(A2,HS,1) = A2),(Vlookup(A2, HS, 2) = "FREE")), "delete", "keep")

Does this accomplish what you are looking for?
=IFERROR(IF(VLOOKUP(A3;Sheet2!$A$1:$C$5;2;FALSE)="Free";"delete";"keep");"keep")

Related

To get an condition for excel mentioned in the attachment

Please follow the attachment and let me know how can i get true, false and NA condition for the excel sheet
Column A --> It has repeated set of ID's (A,B,C)
Column B --> Data 1 to be compared with Data 2. And if the data2 is anywhere present in Data 1 and both share the same data from column ReportID, I should get true...otherwise false...and if data2 is blank then NA
Just use COUNTIFS:
Formula in column D:
=IF(C2="";"NA";COUNTIFS($A$2:$A$11;A2;$B$2:$B$11;C2)>0)

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

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!

Excel 2010: Vlookup Name from one column & Count and return data from another column

Hoping someone can help me here. :)
I have two columns of data in Worksheet 1:
COLUMN A = NAME (EG. TOM)
COLUMN C = TYPE OF QUERY (FAX, TEL, EMAIL, MAIL)
I would like to have in Worksheet 2:
COLUMN A = NAME (EG TOM)
COLUMN B = A COUNT OF HOW MANY FAXES TOM HAS
COLUNN C = A COUNT OF HOW MANY TELEPHONES TOM HAS
COLUMN D - A COUNT OF HOW MANY EMAILS TOM HAS
COLUMN E = A COUNT OF HOW MANY MAILS TOM HAS
If anyone can help me that would be great.
Thanks guys
You can use a pivot table. In sheet 1, click into the data table, then click Insert > Pivot table.
Drag the Name field to the rows. Drag the query type field to the columns.
Drag the Namie field again, this time to the Values area, where it will turn into a count.
Now you see a count of query types for each name in a matrix.
Use countifs instead if you really want to use formula. A pivot table would be the best way to go though.
eg for column B, row 1 on sheet 2:
=COUNTIFS(Sheet1!A:A, A1, Sheet1!C:C, "FAX")

Match name and copy row from sheet 1 to sheet 2 on corresponding column

I asked a very similar question to this one here, but I am trying to identify if a cell's numerical value is contained in a list of cells on a different sheet. If the cell from sheet A matches a cell in sheet B, mark a different column in B with a corresponding row in sheet A, otherwise leave it blank. An example is below:
Sheet A
Column A | Column B
-------------------
1 John
2 Sue
4 Bob
I would like the corresponding Sheet B to populate Column B like this:
Sheet B
Column A | Column B
-------------------
2 Sue
3
4 Bob
=IF(ISNUMBER(MATCH(I2, 'SALT, WOD, Champion Members'!A:A, 0)), "Y", "N")
I have been using the above answer to populate a different column in the same workbook, and I'm thinking I can maybe use this formula, but instead of "Y" or "N", somehow preserve the row.
You need to use VLOOKUP as already mentioned. But you will need to use another function to check for existence of the value, else you will get #N/A against ID 3
I used COUNTIF
=IF(COUNTIF($A$2:$A$4,E2)=0,"",VLOOKUP(E2,$A$2:$B$4,2,FALSE))
Use the VLOOKUP function:
=VLOOKUP(A1;Sheet1!A:B;2;FALSE)
Where A1 is the value you want to look up, Sheet1!A:B is the original sheet with the data.

Resources