메인 컨텐츠로 가기

Excel에서 필터링 한 후 첫 번째 표시되는 셀의 값을 찾고 가져 오는 방법은 무엇입니까?

경우에 따라 필터링 된 목록에서 첫 번째로 보이는 셀의 값을 가져와야 할 수 있습니다. 그것을 달성하는 방법? 이 기사에서는이를 해결하는 방법을 보여줍니다.

배열 수식으로 필터링 한 후 첫 번째 표시되는 셀의 값을 찾아서 가져옵니다.
VBA로 필터링 한 후 첫 번째 보이는 셀의 값을 찾아서 가져옵니다.


배열 수식으로 필터링 한 후 첫 번째 표시되는 셀의 값을 찾아서 가져옵니다.

다음 배열 수식을 적용하여 필터링 된 목록에서 첫 번째로 보이는 셀의 값을 가져올 수 있습니다. 다음과 같이하십시오.

1. 첫 번째 보이는 값을 넣을 빈 셀을 선택하고 아래 수식을 입력 한 다음 Ctrl 키 + 변화 + 엔터 버튼 키를 동시에 누릅니다.

=INDEX(C2:C19,MIN(IF(SUBTOTAL(3,OFFSET(C2,ROW(C2:C19)-ROW(C2),0)),ROW(C2:C19)-ROW(C2)+1)))

주의 사항: 수식에서 C2 : C19는 표시되는 첫 번째 셀 값을 반환하려는 필터링 된 목록이고 C2는 목록의 첫 번째 셀입니다. 필요에 따라 변경할 수 있습니다.

그런 다음 위의 스크린 샷과 같이 선택한 셀에 채워진 필터링 된 목록에서 첫 번째로 보이는 셀의 값을 볼 수 있습니다.


VBA로 필터링 한 후 첫 번째 보이는 셀의 값을 찾아서 가져옵니다.

위의 배열 수식을 사용하여 필터링 된 목록에서 첫 번째로 보이는 셀의 값을 가져 오는 것 외에도 아래 VBA 스크립트를 실행하여 필터링 된 목록의 첫 번째 보이는 셀을 빠르게 반환 할 수 있습니다. 다음과 같이하십시오.

1. 필터링 된 목록의 첫 번째 보이는 셀 값을 배치하려면 E8과 같은 빈 셀을 선택합니다.

2. 프레스 다른 + F11 동시에 열려면 키 응용 프로그램 용 Microsoft Visual Basic 창.

3. 에서 응용 프로그램 용 Microsoft Visual Basic 창을 클릭합니다 끼워 넣다 > 모듈. 그런 다음 아래 VBA 코드를 복사하여 모듈 창에 붙여 넣으십시오.

VBA 코드 : Excel에서 필터링 한 후 첫 번째 표시되는 셀의 값 찾기 및 가져 오기

Sub FirstVisibleCell()
   With Worksheets("Sheet1").AutoFilter.Range
       ActiveCell.Value2 = Range("C" & .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Value2
    End With
End Sub

주의 사항: 코드에서 Sheet1은 필터링 된 목록이 포함 된 시트 이름입니다. "C"는 첫 번째 표시 값을 가져 오려는 열 이름입니다. 필요에 따라 변경할 수 있습니다.

3. 누르세요 F5 키를 눌러 코드를 실행하면 C 열에있는 필터링 된 목록의 첫 번째 보이는 셀이 즉시 E8 셀에 채워집니다.

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (18)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thanks a lot, that formula INDEX(C2:C19,MIN(IF(SUBTOTAL(3,OFFSET(C2,ROW(C2:C19)-ROW(C2),0)),ROW(C2:C19)-ROW(C2)+1))) literally save my soul.
Even though I still do not get how the formula works, it does provide the return that I would like to have.

Regards,
Vedat
This comment was minimized by the moderator on the site
Thank you!
This comment was minimized by the moderator on the site
In the following VBA code, can you please explain what does SpecialCells(xlCellTypeVisible)(1) mean? What is (1) used for after SpecialCells(xlCellTypeVisible)?
ActiveCell.Value2 = Range("C" & .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Value2
This comment was minimized by the moderator on the site
Can you help me write this formula in google sheet with arrayformula ()

{=INDEX(C2:C19,MIN(IF(SUBTOTAL(3,OFFSET(C2,ROW(C2:C19)-ROW(C2),0)),ROW(C2:C19)-ROW(C2)+1)))}
This comment was minimized by the moderator on the site
So for me the answer above simply does't work that well. I have a workbook with over 23k rows and is something I've been working to optimize over the years. My solution came to me this morning in yet another spark of inspiration.
Assuming that you are using a TABLE to get the data you want do this:One row (I named it "Rownmbr") is dedicated to: =CELL([@[YOURFIRSTROW]])
Outside the table you make a formula somewhere:=INDIRECT(CONCATENATE("A";SUBTOTAL(105;Table1[Rownmbr])))
You simply replace the "A" with wherever you want to get the data from. For me this works great, and it's not a heavy formula to use that will bog down the document further.
This comment was minimized by the moderator on the site
This solution worked perfectly for me, since I was using a table. The instructions were hard to follow, so hopefully this explanation will be a bit clearer.
Say you have an excel table named "Table_Name."  First, create a new column in your table and name it "RowNumber". 
In that new column, enter the formula "=ROW([@RowNumber])" This will then populate the new column with
In the cell where you want to display the first visible value, enter the formula "=INDIRECT("A"&SUBTOTAL(105,Table_Name[RowNumber]))"  The "A" is the letter of the column that holds the value you want to return.
The SUBTOTAL(105,...) function returns the minimum value of all the visible rows in a given range, which in the case above will return the row number of the first visible row.
The INDIRECT function returns the value of the cell for a given cell address. This is why you need the first part of the formula to contain the column letter of the column you want to display. The second part of the formula will return the row number.


This comment was minimized by the moderator on the site
This formula works, but be aware that if you have blank cells, the formula can malfunction and select the first value in the entire table, not just in the filtered results. The workaround I found was to replace blank cells with NULL or a space.
This comment was minimized by the moderator on the site
First I had blanks.... then all cells were filled but still having the #VALUE response. Hopefully this formula works on text as well...! Thanks for the advise anyway ;-)
This comment was minimized by the moderator on the site
It works. Thanks so much...
This comment was minimized by the moderator on the site
Thanks a million🙏🌺
This comment was minimized by the moderator on the site
‌wonderful🌺 Thanks a million🙏
This comment was minimized by the moderator on the site
I keep getting a Run-time error '91' Object variable or With block variable not set. My worksheet is Sheet1 titled AllBrands. This is my formula :

Sub FirstVisibleCell()
With Worksheets("ALLBRANDS").AutoFilter.Range
ActiveCell.Value2 = Range("H" & .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Value2
End With

End Sub

Any help will be appreciated!
This comment was minimized by the moderator on the site
Unfortunately - neither the formula - that gives me a #VALUE error nor the VBA works for me giving me a run-time error '1004'
Too bad as I have Office 2019 and I was expecting one of these features to work when filtering specific cells... :-(
This comment was minimized by the moderator on the site
Hi Bub,
The code works well in my case. Which Excel version are you using?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations