Excel remove more than 2 duplicate records from a column - excel

Excel has function to remove duplicates but what if i want only first 2 records of each value in a column.
E.g. Sheet
Email Value
abc#gmail.com 23
xyz#yahoo.com 24
sns#abc.com 75
abc#gmail.com 51
lkj#asd.com 85
abc#gmail.com 95
xyz#yahoo.com 52
uhk#asj.com 95
uhk#asj.com 42
Expected Result Sheet
Email Value
abc#gmail.com 23
xyz#yahoo.com 24
sns#abc.com 75
abc#gmail.com 51
lkj#asd.com 85
xyz#yahoo.com 52
uhk#asj.com 95
uhk#asj.com 42
Note that "abc#gmail.com 95" record which was third entry for the email id was removed. All other records has either one or two entries. No record is allowed for more than two entries. I have thousands of these in a sheet and need to only have first two entries of each email. Can anyone tell me how i can i delete more than 2 records as in above example?

create a helper column with the following formula:
Assuming "abc#gmail.com" is in cell A2, enter this formula in cell C2
=Countif($A$2:A2,A2)>2
This will result in a TRUE/FALSE value. Copy/Fill down the formula to the bottom of your list.
Since this formula returns TRUE for the first two instances of the email address, all of your FALSE values can be deleted from your worksheet.

Related

Is it possible to have IF formula delete a row?

I have a formula that right now pulls and outputs on another sheet whether the B1 Cell is equal to “YES” then print A1 in the new sheets Cell I have the formula entered in, if it is not then it leaves the cell blank and this goes on for as many cells as needed.
Here is my formula
=IF((Sheet1!B1)=“YES”,Sheet!1A1,””)
I am wondering if there is a way to change the formula to where if it is not equal to “YES” then instead of leaving the Cell blank it deletes the entire row instead.
I know the final ,””) part of the formula is what I used to state the Cell will be blank. I’m just unaware if there is a function or anything I can input instead to state if not “YES” then delete the Row.
Example of what is happening:
If I have these entries in Sheet 1
A
B
1
85
YES
2
47
NO
3
74
YES
The output on Sheet 2 using my formula will be:
A
B
1
85
2
3
74
I am looking for it to look like this:
A
B
1
85
2
74
3
Thanks!

Excel splitting one row into separate rows of a fixed number of colums

Here is a sample of the data I have in one row in an excel file. I would like to split it into multiple rows after every seven columns
15-Feb 20 783 175 105 $180 $973 15-Mar 31 900 58 145 $106 $140
to
15-Feb 20 783 175 105 $180 $973
15-Mar 31 900 58 145 $106 $140
You can use this formula:
=INDEX($1:$1,INT(COLUMN()+(ROWS(A$5:A5)-1)*7))
drag/copy this formula across till row 7 and down as required.
Issue with this formula is it will return 0 if cell is blank.
So alternatively, you can check for cell blank condition and write formula as:
=IF(ISBLANK(INDEX($1:$1,INT(COLUMN()+(ROWS(A$5:A5)-1)*7))),"",INDEX($1:$1,INT(COLUMN()+(ROWS(A$5:A5)-1)*7)))
If you have a well defined and deterministic way to split the two halves (for instance, columns "A" to "D" is the first half, while columns "E" to "H" is the second), you can enter a formula in a different sheet like (this is pseudo-code; you will need to verify the syntax):
Cell "A1" of the new sheet: ='Other_Sheet'!A(round(row()/2)+1)
Cell "A2" of the new sheet: ='Other_Sheet'!E(round(row()/2)+1)
The indirect reference is made such that it will go to the next row in the source sheet every two rows in the new sheet.

Send data (Job #) in one column to another spreadsheet, if another column contains data

Here is a sample of the data I'm using. The letters are the estimated time in each area of the workshop (i.e. A. is clean up, B. is welding etc.):
J/C # A. B. C. D. E. F. G. H. TOTAL
97647 45 45 90 30 120 330
97651 15 30 45
97626
99999 60 120 75 360 615
11111 90 30 15 15 150
12345 10 20 30 40 50 60 70 80 360
On another sheet I need a column of all the Job Card numbers (J/C #) for each workshop area. I would like these automatically to appear when the budgeted time is put into this first sheet.
For example the Welding Sheet will have the following J/C #.
97647
99999
12345
I have been trying INDEX and MATCH and LOOKUP and VLOOKUP functions, but haven't yet found a solution.
Is this possible?
I have a solution that works -- hopefully I can explain it clearly.
Let's say your table is on "Sheet1". Create new sheets, one for each workshop (so, I have a "Sheet1", "A","B","C",...,"H").
In your "A" sheet, put this formula in A1:
=IFERROR(INDEX(Sheet1!$A$2:$A$10000,SMALL(IF(Sheet1!B$2:B$10000<>"",ROW(Sheet1!A$2:A$10000)-ROW(Sheet1!A$2)+1),ROWS(Sheet1!A$2:A2))),"") Enter with CTRL+SHIFT+ENTER and drag down.
This will create a population of those Job #s that have some value under the "A." column in "Sheet1".
To use this formula for your "B." column, put this formula in sheet "B", cell A1:
=IFERROR(INDEX(Sheet1!$A$2:$A$10000,SMALL(IF(Sheet1!C$2:C$10000<>"",ROW(Sheet1!A$2:A$10000)-ROW(Sheet1!A$2)+1),ROWS(Sheet1!A$2:A2))),"")
Notice the only change is in the "SMALL(IF(Sheet1!C$2:C$10000<>..." That's because since you want to return any job numbers for your "B." column, which is in Column C of Sheet1. ...so for your "C." Sheet, in A1, put the above formula but using column D for the "Small(If(Sheet1!C$2:C$10000" part.
Does this make sense?
The only thing is that you'll need to tweak depending on your sheet names (since I don't know what C,D,E, etc. actually refer to).

Index/Match values from a column using a grid of a different length (Excel 2010)

I am trying to index match values from a long column to a grid of a different length. It looks like this
Word Number Column X Column Y Column Z
This 55 55 33 12
is 62 62 42 18
The 78 78 31 24
42
31
12
18
24
33
The grid (Column X,Y,Z) contains all the values from the Number Column. What I am trying to do is basically index the "Word" column, using a value from the "Number" Column, and looking it up in the value array of X Y Z.
Example (because this is confusing):
Input the Value 33 from the Number column, look for the value in the columns XYZ, and then return the Word "This".
Input the Value 18 from the number column, look for the value in columns XYZ, return the word "is"
etc...
Any help would be very much appreciated!
there is a quicker way and shorter formula to do this:
=IFERROR(INDEX(A:A,IFERROR(MATCH(B2,C:C,0),IFERROR(MATCH(B2,D:D,0),MATCH(B2,E:E,0))),1),"not found")
paste that into, any column really, into row 2 and drag down, it will return the words you require, if value not found it will return "not found"
Here is your spreadsheet starting at cell A1 (without your headers):
A B C D E
1 This 55 55 33 12
2 is 62 62 42 18
3 The 78 45 31 24
4 42
5 31
6 12
7 18
8 24
9 33
10
11 Input: 24
12 Output: The
Copy this into cell C10, and drag the formula across to cell E10:
=IF(ISERROR(IF(ISERROR(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))),"",INDIRECT(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))))),"",IF(ISERROR(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))),"",INDIRECT(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0))))))
Copy this to the "output" cell B12 and use cell B11 as your "input":
=CONCATENATE(C10,D10,E10)
VIOLA!!! You're done!
Proof:
The MATCH() function will look for your value in an array (the range). If it finds it, it returns the index of that array (indexed at 1), otherwise it throws an error. Be sure to set the 3rd argument to "0" so that it only looks for EXACT matches.
Paste this into C14:
=MATCH($B$11,C1:C3,0)
Next, we check if the MATCH() function did indeed throw an error. Paste this into C15:
=IF(ISERROR(C14),"",C14)
Now we have the row number of our matched value, so we will use the CONCATENATE() function to join it to our "word column", A, for use in the next step. Paste this into C16:
=CONCATENATE("A",C15)
Using that string from above, use the INDIRECT() function to turn it into an actual cell reference. Paste this into C17:
=INDIRECT(C16)
And finally, check if a legitimate cell reference was created. If so, return the word, otherwise return "". Paste this into C18:
=IF(ISERROR(C17),"",C17)
Lastly, drag the formulas from C14:C18 to E14:E18, and concatenate the results. The cells in row 18 should match the cells in row 10.
Hope this helps :)

Add .html to each single field value and add new field with 'custom_permalink'

I have CSV file and I can view it in excel. Here is example data:
ID Product Name
75 dale-earnhardt-jr-adult-costume
77 dale-earnhardt-jr-adult-costume-2
79 plastic-jeweled-crown
81 dollar-ring
83 the-wizard-of-oz-shoe-covers-child
1) I need to add '.html' at the end of product name like dollar-ring.html
2) I want add new column with value 'custom_permalink'
Output should be like:
ID New Column Product Name
75 custom_permalink dale-earnhardt-jr-adult-costume.html
77 custom_permalink dale-earnhardt-jr-adult-costume-2.html
79 custom_permalink plastic-jeweled-crown.html
81 custom_permalink dollar-ring.html
83 custom_permalink the-wizard-of-oz-shoe-covers-child.html
I've 30K records and want to add this using some easy way of excel?
Open/import your CSV file in Excel. Say, it is now in columns A and B.
In cell C1 write =A1.
In cell D1 write custom_permalink.
In cell E1 write =B1&".html".
Select cells C1:E1 and fill the formula till the bottom of your data.
Copy and paste special columns C:E as values only.
Delete columns A:B.
In cell B2 of CSV file add the below formula.
=CONCATENATE(A1, ".html")
Select the range in column B and filldown formulas using shortcut key CTRL+D.

Resources