I need VBA code that will delete all rows with column A equal to "XXX" if column B is equal to "YYY".
Example: I have a spreadsheet that looks like this: column A has multiple rows with the same value but the value in column B is different for every row. I want to delete all the records with the same value in column A if column B has a specific value.
This is something that would be very easy to create using the Macro record feature of excel and then modify the code to fit the specifics you are needing.
Related
I am looking to find a way to fill a whole column with the same output, "Yes", based on the number of cells in the adjacent column.
For example, if there's data in A2:A10, I would like B2:B10 to be filled with "Yes". If more data is added to column A, I'd like column B to automatically update / spill the "Yes" into additional rows within B based on the number of entries added to column A.
I'm aware that I can do an =IF(ISBLANK()) statement for each row, but I am trying to reduce the number of formulas. I'd like to try and do this with a single formula within the top row of column B that spills down.
The value in column A can change, I'm only trying to check the number of non-blank values.
I'm using Excel / Office 365.
This is a generic solution for column A containing mixed datatypes:
=REPT("Yes",A2:INDEX(A:A,MAX(IFNA(MATCH(IF({0;1},"Ω",77^77),A:A),0)))<>"")
In column C, there are duplicate values that I don't want. How do I go about filtering the rows by the condition - Show the rows where there are duplicate values in column C?
I would add a helper column at the end with =COUNTIF(C:C;C1) and copy it down behind every row with data. Then filter on >1.
Or you can create a pivottable and put column C in the values as a count.
Easiest way is to add conditional formatting for duplicates and then filter on colour - it doesn't involve changing your data set at all and is an easy visual cue as to where duplicates exist. However, similar to the answer above, this will filter out both the original and the duplicate record.
If you want one of the rows to show (i.e. 1 of each value in column C), then a new column with the COUNTIF formula applied to the range starting 1 cell below or above would work. So if the new column was "D", in cell "D2", you would use either;
Cell above:
= COUNTIF($C$1:$C1,$C2)
OR
Cell below:
= COUNTIF($C3:$C$9000,$C2)
Note: if you use the count from the cell below (i.e. to show the last row where that value is found), you will need to assign a "finish row" - I used 9000, but you could go to 1048576 if you want to include whole sheet.
You would then filter column D to only show 0s
These solutions assume you still want to keep the records, just hide them. If this is not the case, there are easy ways to delete duplicates.
I need to know based on the attached Excel, how to group column A and B which have duplicate values and return the MAX value/row of another column in this case column C and D.
What you describe can be done with a simple Pivot Table.
Drag A and B into the rows, drag C and D into the Values and then change the value field settings to show the Maximum value.
You need to add column headers to the data, so you can identify the data by column name. It's not clear from the screenshot "A", "B", "C" are the Excel built-in column letters or your data headers.
You also need to clean up the data since it looks like the numbers are stored as text. You will not be able to perform any calculations like "maximum" unless you convert the text back to numbers.
I have an xlsx sheet (using MS Office 2010) with around 10-15K rows and multiple columns. I want to consider two columns to filter this data but need data from all the existing columns. Sheet looks like
The id column can have duplicate records. The rule I want to apply is:
1) For the set of duplicate ids in column id, select only 1 row which has highest value in corresponding timestamp column.
2) So as result this should give only distinct ids with hisghest timestamp among it's set of duplicate values.
3) Considering the data in the sheet, the result should have only two rows that I have filled in with yellow color.
Can you please help me on how to setup rule to do this in excel?
Sort by id then timestamp (descending). Add a new column after B and use
=COUNTIF(A$2:A2,A2).
Filter that column to show only 1's
Do a descending sort on Columns A and B and then use Remove Duplicates on Column A only. The highest values should be the first found, and anything else will be deleted.
Without sorting for a Range from A2 to A24 you can use:
=B2=MAX(B$2:B$24*(A$2:A$24=A2))
If you have any questions, just ask ;)
I have a data table with 8 columns and i want to know if anyone can help me come up with a formula to get the name in the first column if i enter a value into the columns (3,4,5,6,7,8).
I want the name from the first column to appear in another table on another sheet where only names appear where data is in the columns (3,4,5,6,7 & 8)
Try this:
=IF(OR(Sheet1!C2<>"";Sheet1!D2<>"";Sheet1!E2<>"";Sheet1!F2<>"";Sheet1!G2<>"";Sheet1!H2<>"");Sheet1!A2;"")
You can use C1 = 1 .... if you prefer.
And C1,D1,E1... have to be replaced with your columns.
Also Sheet1 have to replaced with your sheet name
I would use a Pivot tables.
First create a new column in the existing table:
If you only having positive values then it is:
=sum(C2:H2)
If you have zero and negative values as well it would be like this:
=IF(COUNTBLANK(C2:H2)=6;0;1)
Then make a pivot table with the "TO/TA name" in the Row Labels and the new column in Report filter - where you then removes the "0".