How can I delete all the rows where the value of columnA is equal to the value of columnB in excel? - excel

How can I delete all the rows where the value of columnA is equal to the value of columnB in excel? I found some articles but they are all talking about deleting rows with some conditions for one row (then i can use filter in excel to get the rows). But how can I filter rows where the condition needs values from two columns? thanks.
like if i have
Row columnA columnB
1 10 10
2 20 20
3 30 40
4 50 70
then I want to keep row 3 and row4 and delete row 1 and row2 because they have the same value for columnA and columnB

OPTION 1
Something like this in an adjacent column?
=FILTER(A:B,A:A<>B:B,"")
It will reproduce column A without the duplicates.
OPTION 2
If you are looking for a way to quickly distinguish where the rows match and do not match (based on your comment) I would suggest a conditional format using the following:
=$A1<>$B1
OPTION 3
Or utilize the formula in cell C1:
=IF(A:A<>B:B,"Not Equal","")

Related

How do I create rows in a table based off a cell value and fill a column also based off the cell values in Excel

I am looking to create and fill a table based on two cell values.
If D2 and E2 contain the values 64 and 8 respectively. I want to create a column in a table that has 64X8 rows (not a 64x8 table). Then I want to fill the column with values 0-63 and repeat 8 times.
For example, the table will have a column with values:
0
1
2
3
4
...
63
0
1
2
3
4
...
63
The 0-63 pattern repeating 8 times.
Is this possible? Sorry if my explanation isn't clear. I can provide more detail.
Try below formula-
=MOD(SEQUENCE(D2*E2,,0),D2)

How would I delete a row of data if none of the cells are empty?

I have a spreadsheet with sales data for a given month for a number of different stores. There are approximately 450 rows (stores) to go through. The days of the month are in row 1, starting in column B, with the store numbers in column A, starting in row 2. What I need to find are the rows that are missing data for different days. I can use conditional formatting to highlight the cells that are empty, but that is still a lot to look at. What I am trying to do is reduce the amount of cells to look at by deleting any rows that are not missing data. So if a row is not missing any days of data, then I don't need to look at it, and can delete it. But if it is missing data, then keep the row.
I'm stuck on figuring out the actual code, but I have come up with pseudo code for what I want:
foreach row in range ($B$2:$AB$450)
foreach cell in row
if cell < 1
delete row
end foreach
end foreach
Here is an example of the spreadsheet:
A B C D
1 12/1/2019 12/2/2019 12/3/2019
2 Site 1 1000 2000
3 Site 2 5000 5000 3000
4 Site 3 6000 4000 3000
In this example, rows 4 and 4 would be deleted because they are not missing any data.
Thanks
**assuming that you have 4 columns and they start in column B:
with an array formula you can see the length of characters in each row.
=MIN(LEN(B2:E2))
for example, you can use the above formula in row 2 (remember: ctrl+shift+enter to use it)
So, if you apply that formula per row, you should be able to know if you have missing value per row (all of them that have length 0 per row); then, use that column to filter. E.g. Filter anything that is not 0.

Excel 2010 columns contain more than one number, need to sum all numbers within the column from multiple rows

Need to SUM Excel columns where 1 row has several numbers within one column
Column B
Row1 68
136
68
Row2 1394
931
33
33
Row3 33
420
350
250
SUM B1:B3 only SUMs first number in cell ?? Help please.
I see no straightforward way to accomplish this.
However, you may flatten the cells into individual values.
Parallel to each cell, issue the formula
=SUBSTITUTE(A1, CHAR(10), ",")
This will make each cell comma separated. Your row one will become
68,136,68
You may then employ text to columns under the Data ribbon using the comma delimiter to give each number its own cell.
Thereafter you may rearrange the numbers and issue your SUM.
1] In C1 and copied down to suit:
="="&SUBSTITUTE(B1,CHAR(10),"+")
2] Copy ColumnC and Paste Special..., Values over the top, Replace All = with =.

Need to match data in different sheets and replace data in another cell if it's a match

I need to match data in column A2 and so on in sheet 1 to data in column A2 and so on in sheet 2. If the data in column A of sheet 1 and sheet 2 match I need the data in column B & C of sheet 2 to replace data in column B & C of sheet 1. I know VERY little about doing this kind of stuff so any help would be GREATLY appreciated!
SHEET 1
A B C
2 12345 5.35 9.95
3 15874 4.22 10.99
4 11111 2.24 5.99
5 98745 5.33 9.95
6 88552 4.24 8.95
SHEET 2
A B C
2 11111 2.09 5.79
3 12345 5.11 9.89
4 88552 4.01 8.79
NEED SHEET 1 to change to
A B C
2 12345 5.11 9.89
3 15874 4.22 10.99
4 11111 2.09 5.79
5 98745 5.33 9.95
6 88552 4.01 8.79
On a third sheet use these functions
column a ='sheet1'!a2
column b =if('sheet1'!b2='sheet2'!b2,'sheet2'!b2,'sheet1'!b2)
column c =if('sheet1'!c2='sheet2'!c2,'sheet2'!c2,'sheet1'!c2)
Copy sheet3 and paste the values into sheet1.
This should work unless column a does match. or if you need to do this dynamically. If column a doesn't match some vlookups can be thrown in.
I your data does match in column a your formulas could look something like this.
column a ='sheet1'!a2
column b =if(not(iserror(vlookup(a2,'sheet2'!a:c,2,false))),vlookup(a2,'sheet2'!a:c,2,false),vlookup(a2,'sheet1'!a:c,2,false))
column c =if(not(iserror(vlookup(a2,'sheet2'!a:c,3,false))),vlookup(a2,'sheet2'!a:c,3,false),vlookup(a2,'sheet1'!a:c,3,false))
this is too much to put in a comment so I'm putting it in answer.
The way I under stand is, since sheet1 has more data, you only want to be doing this comparison when sheet1 and 2 both have data on the row. so If sheet1 has data in rows 1 - 100, and sheet2 has data in rows 1 to 50, you only want to be doing this comparison for the first 50 rows in sheet1 right?
So, rather than copying and pasting formulas, what you can do is, in sheet1, find an unused column. go to the first row. in the formula box, type: "=if(" without the quotes. now, select the first cell to compare, according to your example you'd select sheet1, A2. then type "=" without quotes. then select the second cell you want to compare - in your example, sheet2, A2. then type "," without quotes. then select the cell from which you want the data if the first 2 cells are equal. in your example, sheet2 B2. then type "," without quotes, then select the cell with the data to use if the first 2 cells are not equal. in your example, sheet1 b2. then type ")" without the quotes.
so using your example, the function would look similar to how bigtree had it: =if('sheet1'!A2='sheet2'!A2,'sheet2'!b2,'sheet1'!b2)
so, this will compare sheet1 cell A2 with sheet2 A2 and if they are equal, the cell you put the formula in will the have the value of sheet2 b2, and if they are not equal, the cell with this formula will have the value of sheet1 B2. then, drag this formula down for however many rows you want, and the formula will adjust automatically for each row. you'll see the numbers increase. then, select the column with the formulas, right click and select copy, then right click and go to paste special, and click values. this will make it so the column contains only the values, not the formulas, now you can paste this data in column B sheet 1.
you can reuse this formula for whatever columns, just follow the steps.
HTH, good luck!

How to count number of matches between two columns in Excel?

How to count number of matches between two columns in Excel?
For example if we have:
1 1
2 1
3 2
4 4
5 3
I need to get either a column like this:
1
0
0
1
0
and then I can sum the ones in there to get the count of matches.
Option 1: IF
=IF(A1=B1;1;0)
This formula will put 1 in the cell if A1 = B1, and 0 otherwise.
Option 2: COUNTIF
Write =A1=B1 in C1, etc., in the column cells. This will fill the C column with TRUE and FALSE values.
At the bottom of that column, add a cell =COUNTIF(C1:C100;TRUE) so that you count the cells between C1 and C100 which have value TRUE.
You may find the TechRepublic article Use COUNTIFS() to compare two data sets in Excel of use. See also Microsoft's documentation on countifs().

Resources