Duplicates location in Excel Online - excel

I have an online Excel workbook that I'm working on and I wanted to know if there is a way we could find out the exact location of where the text has duplicates.
I found a solution in the Excel downloaded macro workbook using VBA but I got to know Excel macro does not work online therefore I need to find a different solution to show the duplicates location in the online Excel workbook.
For instance, using conditional formatting I formatted it to show me it is a duplicate but I want it show the row number of where the duplicate is located. Does the Excel online offer any such feature?

you can use a formula to retrieve the duplicates row = 1. helper column
=IF(COUNTIF($A$2:A2,$A2)>=2,ROW(A2),"")
then in the 2. helper column you add this formula:
=IF([#[row of duplicate]]<>"",TEXTJOIN(",",TRUE,FILTER([row of duplicate],([Name of Contact]=[#[Name of Contact]])*([row of duplicate]<>""),""),""),"")
Output is written to the first value with duplicates.
It joins the result of the row numbers by first filtering them by the name of the contact.
You need Excel 365 for this.

=IF(COUNTIF($A$2:$A5, $A5)>1, ROW(A5), "") will return the row number as a second column
=CONCATENATE("Duplicates Exist in: ",TEXTJOIN(", ",TRUE, B2:B15)) will return those numbers back as a single cell that looks like Duplicates Exist in: 7.
Note: the above if identifies only the duplicates after the first, a slight modification would list all duplicate occurrences.
sources:
https://www.ablebits.com/office-addins-blog/2016/03/02/identify-duplicates-excel/ & https://www.exceldemy.com/excel-combine-rows-into-one-cell-2/

Related

How to count unique column data in an excel sheet

I am using excel sheet and i have data column as shown below:
As we can see that some of the names are duplicate or appeared twice. My question is how can count unique name records or rows associated with each name for summary column.
Out put i am looking for is shown below:
Not sure which formula to use as count is counting all of that data i.e. '7' in this case. How can i use count or any other function to count unique records as shown above?
You can do what you're after with a pivot table.
Click the Insert tab then select "Recommended Pivot Tables".
A window will open up prompting you to select the data range. I recommend using a named range for your list and referencing that, but you can just highlight the list directly if you want.
Once the data range is selected, click "Ok" and new window will open with exactly what you want. A unique values list and a "Count of Column1". It is the default of the recommended pivot tables.
I outlined this because it's easy and fast, but it's important to understand you can make this pivot table yourself from scratch if you learn about pivot tables in general. Pivot tables are often overlooked in Excel as an option.
Lastly, you could get really advanced with Excel Power Queries. Just Google "Excel Power query" and you will be shown all kinds of information on them. They are a close second place in power to manipulate Excel data short of using VBA.
Good luck!
CountA(Unique(D2:D8,,False)) = 5 [Count(Unique(D2:D8)) is the same as False is the default.]
CountA(Unique(D2:D8,,True)) = 3 (once and only once)
Note: the Unique function was released in late 2019 to Office 365. So if you want to use this check your version, not present in 1908, present in 2006.
Edit: It's actually in 2002, I just updated my 1908 machine.
HTH
If names duplicates are removed the following formula can be used: =COUNTIF(B:B,F2)
If duplicates must be removed by formula, MATCH (searches for a specified item in a range of cells, and then returns the relative position of that item in the range.) and SMALL (Returns the k-th smallest value in a data set.) functions can be used as shown.
C$1048576 is used to reference last row number for a big list case.
formulas:
Column A, names sequence
Colunm B, names
Column C, formula =MATCH(B2,B:B,0)
Column D, formula =IF(COUNTIF(C2:$C$1048576,C2)=1,C2,"")
Column E, formula =SMALL(D:D,A2)
Column F, formula =VLOOKUP(E2,A:B,2,0)
Column G, formula =COUNTIF(B:B,F2)
For anyone like me without O265's lovely Unique & Filter Functions, and who doesnt want to use a pivot table, and there are many ways to do this, but this i have just done this in normal excel.
List of data in Column H, Formula in column O3. Drag down. Highlights your distinct and unique values from H.
=IF(COUNTIF(H:H,H28)=1,"U - "&COUNTIF(H:H,H28),IF(COUNTIF(H$1:H27,H28)=1,"U - "&COUNTIF(H:H,H28),"-"))
Formula is short. You can just do this and drag down. Apply the same principal to your worksheet data wherever it is.
=IF(COUNTIF(H:H,H3)=1,"U",IF(COUNTIF(H$1:H2,H3)=1,"U","-"))
Similarly, you can just use this formula here (credit goes to this source for this one):
=(COUNTIF($H$1:$H1,$H1)=1)+0
Id like to point out that the above formula is a better formula than mine. It highlights with a "1" (or with a tweak, the value of your choice) the first time any value is seen/spotted on any given list, whether duplicate or unique.
Whereas mine is a bit "more random" when picking up the "unique and distict" values.
Mine gets there in the end, but Extend Office's gets there first, as I think is proper (getting the first time a unqique distict value is spotted/occurs.).
Formula in K5 =IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","") and drag down...
You could append/add a normal basic countif after the results to show how many actual times the given value appears if you wanted. :
=IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","")&" - "&COUNTIF(H:H,H5)

FIlling and cleaning excel cells based on values in adjacent cells

Looking to clean Excel data and make it into a proper dataset using macro/formulae. This is how my data looks like.
Need to convert it like this:
The number of rows can reach >3000 and number of projects under each name is not constant.
Few steps identified are:
1. Remove the blank rows against each task(marked in red)
2. Remove Utilization column
3. Available hours column to populate the value in each empty cell below.
4. Start data and End Date from cell L4 in two new columns
5. Team Name in cell A9 to be populated in a new column "Team Name"
I've tried using the recorded the macro but it doesn't work in a new data set. Hence looking for some expert help.
The keyword to identify what you have to do is unpivot.
You can unpivot your data using:
Power Query, following these steps;
VBA macro, following these steps.
There are also others possible solutions to unpivot data...just use Google to find them.

Excel Formula to Lookup multiple columns

I tried reading other questions on this matter, and everything is very specific to that person so it got pretty confusing...
Anyways, I was looking for a way to use VLOOKUP or Index Match to do the following (I've been trying but I keep running into errors or weird...long....formulas...):
I have 2 excel Sheets. One excel sheet has something like this:
(This is incomplete. I haven't put in prices yet, but I'm working on the formatting and formulas foremost. Just pretend there are prices in those empty cells :) )
The second excel sheet is this:
In the 2nd Sheet, F Column, I was trying to get a formula to match Sheet2ColumnE with Sheet1 Columns A,F,K,P,U & Z and return [depending on whether cell D is B or S] the single or bulk price for the specific item.
I've used the Index Match formula before, but it got tricky when I had to index multiple columns and match multiple columns. Is there a simple way to get this going? Or will I be looping IFs?
Thanks for assistance.
Here is the workbook. Or a sample of it...
Test.xml

Find and Compare Two Columns Excel (With Screenshots)

I have a spreadsheet that will occasionally get new data that I don't know the contents of, I just have to add it to the spreadsheet. Some of the new data is just updating rows that are already in the spreadsheet, and other data is adding new rows. I'm looking for a way to add a column that will tell me if something has changed in the row when I compare the old spreadsheet to the new one.
The sheets have one column that will always have a unique value among all the rows, so I can use that to match rows if the sheets aren't sorted the same way. Here are some screenshots to show what I'm trying to do:
Old Spreadsheet:
New Spreadsheet:
The only solution I can think of is a large nested IF formula that compares each column one by one, something like:
=IF(Old!B2=New!B2,IF(Old!C2=New!C2,"NO","YES"),"YES")
The problem with that is that it gets very hard to look at since my actual data is using 33 columns (not including this "Changed?" column) and new columns could be added in the future.
I'm not very technical with Excel, nor have I ever used VBA, so I apologize in advance if there is a simple/obvious solution that I'm missing.
Thanks in advance for your help.
Using your example, in the 'New' sheet cell D2 and copied down:
=IF(COUNTIF(Old!A:A,A2)=0,"YES",IF(SUMPRODUCT(COUNTIF(INDEX(Old!A:AG,MATCH(A2,Old!A:A,0),0),LEFT(A2:AG2,254)&"*"))=SUMPRODUCT(COUNTIF(A2:AG2,LEFT(A2:AG2,254)&"*")),"NO","YES"))
vlookup would also work well for this problem.
in D2, the formula would be:
=IF(AND(VLOOKUP(A2,Old!A:C,2,FALSE)=B2,VLOOKUP(A2,Old!A:C,3,FALSE)=C2),"NO","YES")
The column numbers (2 and 3) are the columns that correspond to the data you are trying to match, using the ID column.
It's possible to find the appropriate column using MATCH if the column names you have match the column names in the old sheet
This would make the formula look more complex, but Excel would adjust the Old!A:C reference if more columns are inserted.
The formula would look like this to match against column names
=IF(AND(VLOOKUP(A2,Old!A:C,MATCH($B$1,Old!$1:$1,0),FALSE)=B2,VLOOKUP(A2,Old!A:C,MATCH($C$1,Old!$1:$1,0),FALSE)=C2),"NO","YES")
The difference between this and the last one is the use of MATCH($B$1,Old!$1:$1,0) to find the column (using $s to anchor the lookup values)
In this case, specialized software for Excel compare is better.
My company use this software. Check it out.
http://www.suntrap-systems.com/ExcelDiff/
http://www.youtube.com/watch?v=QQgnWr_RT-8

How do I get my formula to always reference to the last sheet?

I currently have 2 worksheets in my excel file.
The first sheet is known as the Summary page, which displays an summary result of the second sheet.
The second sheet is known as the raw data. An example would be a column named Fruits.
Apple
Apple
Apple
Banana
Banana
Pear
In the first sheet, I would have a formula that counts the number of time the respective fruits appear and the result will be displayed in different cells.
=COUNTIF(Fruits!A2:A7,"Apple")
=COUNTIF(Fruits!A2:A7,"Banana")
What I wanna do is, is it possible for me to program the formula such that everytime I add a new sheet of raw data (3rd sheet), the statistics on the first sheet is able to reference to the latest sheet to get the information.
(Assuming that the positioning of the data and all are the same as the second sheet.)
What I have done so far is to come out with a function GETLASTWSNAME() which is able to always retrieve the name of the last worksheet. but it seems kinda impossible for me to nest the function within the countif formula itself.
=COUNTIF((GETLASTWSNAME())!A2:A7,"Apple)
The above formula is how i want my formula to work, but sadly excel does not allow me to do that.
Any comments would be appreciated. Thanks!
You can use the XLM/Range Name workaround for this and not VBA if you prefer
Define a range name, wshNames to hold the array of sheet names
=RIGHT(GET.WORKBOOK(1),LEN(GET.WORKBOOK(1))-FIND("]",GET.WORKBOOK(1)))
Uses David Hager's technique
Use this Excel formula to extract the last sheet name from the array of sheet names
=INDEX(wshNames,COUNTA(wshNames)+RAND()*0)
This formula says look at all the sheets, then return the last (using the COUNTA). The RAND()*0) portion ensures that the formula is volatile and updates when Excel does
If you do use VBA you will need to ensure your GETLASTWSNAME function is volatile, i.e. it gets updated when changes occur.
=COUNTIF(INDIRECT(GETLASTWSNAME() & "!A2:A7"),"Apple")
In Excel with spill function and the new Sequence() you can list all your sheet names with the same technique just from one cell! First to last or last to first, your choice. With Transpose you get a column header for each sheet (Obs volatile).
After defining the named formula wshNames as told by Tomalak ( thanks for the tip ) I used:
=INDEX(wshNames;COUNTA(wshNames)+1-SEQUENCE(COUNTA(wshNames);1;COUNTA(wshNames);-1))
my Excel is using ";" as a separator, you may have to change the semicolons with a comma
Rolf H

Resources