중복을 무시하고 Excel에서 새 고유 값 목록 만들기
중복으로 자주 나타나는 값 열이 있습니다. 다음과 같이 첫 번째 열을 기반으로하는 고유 한 값의 새 열을 만들어야합니다.
Column A Column B
a a
a b
b c
c
c
이 열 B는 실제로 동일한 통합 문서 내의 다른 시트에 표시되어야하므로 sheet2!A1
스타일 형식으로 작업해야한다고 가정 합니다.
명령에서만 작동하는 것처럼 보이므로 데이터 / 필터 메뉴 옵션에 운이 없었습니다. A 열에 새 값을 입력 할 때마다 자동으로 업데이트하려면 B 열이 필요합니다.
Totero의 대답이 맞습니다. 링크도 매우 유용합니다.
기본적으로 필요한 공식은 다음과 같습니다.
B2=INDEX($A$2:$A$20, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$20), 0))
그런 다음 ctrl+ shift+를 누릅니다 enter(또는 배열 수식을 사용하여 작동하지 않음).
여기서 명심해야 할 두 가지 중요한 사항은 전체 목록이 셀 A2:A20
에 있으며이 수식을 셀에 붙여야 합니다 (순환 참조를 제공 B2
하지 않음 B1
). 둘째, 이것은 배열 수식이므로 ctrl+ shift+ 를 눌러야 enter합니다. 그렇지 않으면 제대로 작동하지 않습니다.
여기에 이를 수행하는 방법에 대한 좋은 가이드가 있습니다 .
기본적으로 다음과 유사한 것 :
=INDEX(Sheet1!$A$1:$A$20, MATCH(0, COUNTIF($B$1:B1,Sheet!$A$1:$A$20), 0))
제 경우에는 공식을 사용할 때 엑셀이 동결되었습니다.
B2 = INDEX ($ A $ 2 : $ A $ 20, MATCH (0, COUNTIF ($ B $ 1 : B1, $ A $ 2 : $ A $ 20), 0))
행이 많았 기 때문입니다 (10000). 그래서 아래에 보여주는 다른 방식으로했습니다.
원래 목록을 두 번째 열에 복사 한 다음 Excel "중복 항목 제거"기능을 사용하여 고유 값 목록을 찾을 수 있습니다.
Microsoft Office 웹 사이트에서 복사 :
Select all the rows, including the column headers, in the list
필터링하고 싶습니다.
범위의 왼쪽 상단 셀을 클릭 한 다음 오른쪽 하단 셀로 끕니다.
On the Data menu, point to Filter, and then click Advanced Filter. In the Advanced Filter dialog box, click Filter the list, in place. Select the Unique records only check box, and then click OK.
필터링 된 목록이 표시되고 중복 행이 숨겨집니다.
On the Edit menu, click Office Clipboard.
클립 보드 작업 창이 표시됩니다.
Make sure the filtered list is still selected, and then click Copy Copy button.
필터링 된 목록은 경계 윤곽선으로 강조 표시되고 선택 항목은 클립 보드 상단에>> 항목으로 나타납니다.
On the Data menu, point to Filter, and then click Show All.
원래 목록이 다시 표시됩니다.
Press the DELETE key.
원래 목록이 삭제됩니다.
In the Clipboard, click on the filtered list item.
필터링 된 목록은 원래 목록과 동일한 위치에 나타납니다.
출처 : Microsoft Office 웹 사이트 (링크 제거, 원인 중단)
A의 정렬 된 열 , 당신은 또한이 아이디어를 시도 할 수 있습니다 :
B2=A2
B3=IFERROR(INDEX(A:A,MATCH(B2,A:A,1)+1),"")
B3는 붙여 넣을 수 있습니다. 마지막 고유 일치 후 결과는 0입니다. 이것이 원치 않는 경우이를 제외하기 위해 일부 IF 문을 두십시오.
편집하다:
최소한 텍스트 값의 경우 IF 문보다 쉽습니다.
B3=IFERROR(T(INDEX(A:A,MATCH(B2,A:A,1)+1)),"")
열에서 중복을 제거하려면
- A A-> Z 열의 값 정렬
- B 열 선택
B 열이 선택된 상태에서 수식 입력 상자에 다음을 입력합니다.
=IF(TRIM(A1)=TRIM(A2),"",TRIM(A1))
B 열이 여전히 선택된 상태에서 편집-> 채우기-> 아래를 선택합니다 (최신 버전에서는 B1 셀을 선택하고 외부 상자를 아래로 당겨 열에서 끝까지 확장).
참고 : B 열이 다른 시트에있는 경우 Sheet1! A1 및 Sheet1! A2를 수행 할 수 있습니다.
목록이 포함 된 시트의 워크 시트 모듈에서 :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDest As Range
If Not Intersect(Target, Me.Columns(1)) Is Nothing Then
Set rngDest = ThisWorkbook.Sheets("Sheet2").Range("A1")
Me.Range(Me.Range("A2"), Me.Cells(Rows.Count, 1).End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=rngDest, Unique:=True
End If
End Sub
A2 : A8 범위의 색상 이름 목록이 있고 BI 열에 고유 한 색상 이름 목록을 추출하고 싶습니다.
아래 주어진 단계를 따르십시오.
- 셀 B2를 선택하십시오. 목록에서 고유 한 값을 검색하는 수식을 작성합니다.
=IF(COUNTIF(A$2:A2,A2)=1,A2,””)
- Enter키보드를 누릅니다 .
- 이 함수는 첫 번째 색상의 이름을 반환합니다.
- 나머지 셀의 값을 반환하려면 동일한 수식을 아래로 복사합니다. B3 : B8 범위의 수식을 복사하려면 CTRL+C키보드 의 키 를 눌러 B2 셀의 수식을 복사하고 키 를 눌러 B3 : B8 범위에 붙여 넣습니다 CTRL+V.
- 여기에서 고유 한 색상 이름 목록이있는 출력을 볼 수 있습니다.
따라서이 작업을 위해 먼저 A에서 Z 또는 Z에서 A로 순서대로 데이터를 정렬 한 다음 아래에 설명 된대로 간단한 공식을 사용할 수 있습니다.
=IF(A2=A3, "Duplicate", "Not Duplicate")
위의 공식은 A2 열 데이터 (A는 열이고 2는 행 번호)가 A3 (A는 열이고 3은 행 번호)과 유사하면 Duplicate를 인쇄하고 그렇지 않으면 Not Duplicate를 인쇄합니다.
예를 들어, A 열은 일부가 중복 된 이메일 주소로 구성되어 있으므로 2 열에서 위에서 언급 한 공식을 사용하여 결과에서 2 개의 중복 셀 하나는 행 2와 행 6입니다.
One you got the duplicate data just put filter on your sheet and make visible only the duplicate data and delete all the unnecessary data.
Honestly I followed these examples to a tee and they simply didn't work. What I ended up doing after struggling pointlessly trying to get Excel to work was to just copy the entire contents of my column to NotePad++ where I was able to find an easy solution within minutes. Take a look at this: Removing duplicate rows in Notepad++
Edit: Here is a brief overview of how to do it in TextFX:
Plugins -> Plugin Manager -> Show Plugin Manager -> Available tab -> TextFX -> Install
After TextFX is installed in NotePad++, then you select all your text you want to remove duplicates from, then make sure to check: TextFX -> TextFX Tools -> Sort outputs only UNIQUE lines
Then click "sort lines case sensitive" or "sort lines case insensitive" and it will perform the unique sort.
Find here mentioned above formula with error control
=IFERROR(INDEX($B$2:$B$9, MATCH(0,COUNTIF($D$1:D1, $B$2:$B$9), 0)),"")
where: (B2:B9 is the column data which you want to extract the unique values, D1 is the above cell where your formula is located)
All you have to do is : Go to Data tab Chose advanced in Sort & Filter In actions select : copy to another location if want a new list - Copy to any location In list range chose the list you want to get the records off . And the most important thing is to check : Unique records only .
=SORT(UNIQUE(A:A))
The above formula works best if you want to list unique values in a column.
Another approach, since Excel 2016, is to use Power Query.
Howto:
- select the data (including the field name),
- use menu
Data
>From a table or a range
, - (Excel will change your sheet into an Excel Table, which is very convenient),
- in the Power Query Editor, right-click on ColumnA (the column header), and
Remove duplicates
, - in the menu, choose
Close and load
, choose where you want the result, and you're done, like this. - Whenever you want the result table to update, right-click it and choose
Refresh
.
Benefits :
- it uses the CPU only when manually updated, which is very convenient for long lists,
- if you're curious, this offers many other powerful options.
Drawbacks :
- it doesn't update on the fly (you have to right-click and refresh the result table),
- people with old version of Excel won't be able to refresh the results table.
The MODERN approach is to consider cases where column of information come from a web service such as an OData source. If you need to generate a filter select fields off of massive data that has replicated values for the column, consider the code below:
var CatalogURL = getweb(currenturl)
+"/_api/web/lists/getbytitle('Site%20Inventory%20and%20Assets')/items?$select=Expense_x0020_Type&$orderby=Expense_x0020_Type";
/* the column that is replicated, is ordered by <column_name> */
OData.read(CatalogURL,
function(data,request){
var myhtml ="";
var myValue ="";
for(var i = 0; i < data.results.length; i++)
{
myValue = data.results[i].Expense_x0020_Type;
if(i == 0)
{
myhtml += "<option value='"+myValue+"'>"+myValue+"</option>";
}
else
if(myValue != data.results[i-1].Expense_x0020_Type)
{
myhtml += "<option value='"+myValue+"'>"+myValue+"</option>";
}
else
{
}
}
$("#mySelect1").append(myhtml);
});
'Nice programing' 카테고리의 다른 글
Groovy XmlSlurper 대 XmlParser (0) | 2020.10.24 |
---|---|
CORS 프리 플라이트 캐시를 전체 도메인에 적용하는 방법 (0) | 2020.10.24 |
재고 데이터베이스 설계 (0) | 2020.10.24 |
C # : '+ = anEvent'와 '+ = new EventHandler (anEvent)'의 차이점 (0) | 2020.10.24 |
Android 애플리케이션의 성능을 테스트하는 방법은 무엇입니까? (0) | 2020.10.24 |