Keep all rows whose 1st cell matches other rows' 1st cell - excel

In a excel table (500K+ lines), I would like to keep only those rows, all of them, whose column A is 100% identical to other rows' column A. This is irrespective what's in columns B, C, etc., but the rows must be sorted in their entirety (i.e., rows not to be broken up). Rows whose column A is not 100% identical to at least one other row's column A are to be deleted.
I am looking for possible solutions other than using =COUNTIF(A:A,A1)=1.
For example, the original table:
coumnA columnB
abc 123
0xyz xxx
aaa-123 123
aaa-12 0xyz
0xyz 098
00xyz 098
0xyz x111xx
Keep all occurrences of rows with 100% identical column A:
0xyz xxx
0xyz 098
0xyz x111xx
This formula =COUNTIF(A:A,A1)=1, identifies multiples of column A and works in small sets of rows. Is there a better, more efficient way to accomplish this with row numbers that approach the excel sheet's limit (1,048,576 rows)?

An alternative to =COUNTIF(A:A,A1)=1 is to create a PivotTable with ColumnA for ROWS and Count of ColumnA for VALUES. Then lookup the A values in the PT and if their count is 1 flag them so with filtering on the flag the rows may be deleted.

Related

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.

Equation/ sorting to separate one long column of data into separate columns

I have two columns of data in an excel spreadsheet that is listed like, each date has three numbers associated with it. It is shown like this:
1 112
1 123
1 456
2 788
2 989
2 901
What I am trying to do is have the data shown like this:
1
112
123
456
Then in another column next to it have;
2
788
989
901
Okay, this can be done pretty easily/quickly.
First, select your entire column that has # ### and go to Data --> Text to Columns, and choose “Delimited”, then use a “Space” delimiter. This will separate your numbers by the space, so 1 and 2 will be in Column A, and the three digit numbers are in B (or wherever you decide to put them).
Then, just get the unique values from column A. I tend to copy the entire column to a temporary column (or worksheet), then highlight them and go to Data --> Remove Duplicates. Now you have a list of unique numbers. Copy and paste these (transposing) into (for example) column D.
Then, in D2, enter this formula (adjust ranges as necessary) as an array, using CTRL+SHIFT+ENTER:
=IFERROR(INDEX($B$1:$B$6,SMALL(IF($A$1:$A$6=D$1,ROW($B$1:$B$6)-ROW($B$1)+1),ROWS($B$2:$B2))),"")
Here’s a screenshot of the final output:

Excel Data Manipulation with alphanumberic data

I have two columns in Excel. We can say that column 1 and column 2. Both columns have alphanumeric data i want to minus column 1 from column 2. How can i do that.
Example:
column 1 column two result column
ab ab ad
ac ac
ad
Thanks
There are more sophisticated/cleaner ways to do this, but I'd enter this formula into column C (update your ranges accordingly to capture each list), and then sort the result column:
=IF(COUNTIF($A$1:$A$8,$B$1:$B$4)=0,A1,"")
This compares the list in $A$1:$A$8 to the list in $B$1:$B$4 and places the "differences" in the result column C. I'm assuming that sorting is permissible. But like I said, there are VBA solutions that could do this a little more cleanly.

Problems with implementing a two criteria vlookup substitute (sumproduct or index)

I have data on two tables, DATA and SpreadCodes. I need to write a formula that functions like a two-criteria vlookup. My tables look like this:
DATA table:
Col B ... Col I
01142 589
57834 007
Where Column S is where I'm trying to put the formula and where entries in Columns B & I are numbers stored as text.
SpreadCodes table:
Col A ... Col E ... Col G ... Col J
57834 007 15.50 15.50
45785 35893 10.00 10.00
Where entries in Columns A,E & G are numbers stored as text and where entries in Column J are stored as numbers.
I am trying to search the SpreadCodes table for the row where entries in DATA column B equal SpreadCodes Column A and where Data Column I equal SpreadCodes column E. Once a match is found, I need it to return the value in SpreadCodes column G OR Column J (They are the same, except G is stored as text, J is stored as number, so whichever makes this work).
I have tried several approaches to try to make this work. Nothing I tried below would return anything except an #NA value
I first tried creating a "helper" column where I concatenated the columns in both tables then just compared those values.
I then tried using two different index/match formulas (where one has concatenation included) :
=INDEX(SpreadCodes!G2:G202,MATCH(1,(SpreadCodes!A2:A202=B2)*(SpreadCodes!E2:E202=I2),0),7)
=INDEX(SpreadCodes!A1:K202,MATCH(Sheet2!B2&Sheet2!I2,SpreadCodes!A:A&SpreadCodes!E:E,0),7)
When that didn't work, I tried a sumproduct formula (being careful to specify SpreadCodes column J, since that one was a numerical value):
=SUMPRODUCT((SpreadCodes!A2:A202=Sheet2!C2)*(SpreadCodes!E2:E202=Sheet2!I2)*(SpreadCodes!J2:J202))
Since these codes often have leading zeros, I keep the columns in text so they don't get cut off, but even still, I'm not sure why these formulas aren't working. I've seen these work for other data. Any thoughts/ideas would be appreciated.
The sumproduct() works for me.
=SUMPRODUCT((SpreadCodes!A1:A100=Data!B1)*(SpreadCodes!E1:E100=Data!I1)*(SpreadCodes!J1:J100))
As per your data, This is how my data sheet looks like

Finding matching value in sheet 2 and copy adjacent cells value in sheet 1

I have searched through many similar topics but could find nothing that will do what I need.
I am trying to create a worksheet that will track scores for a darts game.
On Sheet 1 I have two columns that simply tracks each players throws from 501 down to 0
Row 25 is the amount remaining for each player.
In Sheet 2 I have 2 columns. The Column A contains scores that you can check out on, and Column B contains the checkout e.g. (T20, T20, D18). So if the value in row 25 of Sheet 1 matches any of the values in Column A of sheet 2, the I want to display the Value of Column B in the matching row on Sheet 2 Underneath the remaining score on Sheet 1.
Can anyone point me in the right direction?
not sure what you mean exactly, but this formula in row 26 should do the trick:
=index('Sheet 2'!$B:$B;match(A25;'Sheet 2'!$A:$A;0))
if your list separator is comma ,, use that instead of semicolon ;
you might want to use 1 as the third argument of match function, if you want to display the checkout according to the nearest match that is bigger than the number in row 25 and the column A in Sheet 2 is sorted in ascending order (1-9)
or -1 if you want the nearest match that is smaller and column A is sorted in descending order (9-1)
You can use this:
=IFERROR(VLOOKUP(A4, Sheet2!$C$2:$E$65535, 3, FALSE),0)

Resources