Excel에서 날짜를 단어로 빠르게 변환하는 방법은 무엇입니까?
일반적으로 Excel에서 날짜를 다른 날짜 형식이나 숫자로 변환하지만 아래 스크린 샷과 같이 날짜를 영어 단어로 변환하는 데 문제가 발생한 적이 있습니까? 사실이를 처리 할 수있는 내장 함수는 없지만 VBA 코드입니다.
정의 된 함수를 사용하여 날짜를 단어로 변환
다음은 날짜를 단어로 변환하는 데 도움이되는 매크로 코드입니다.
1. 사용하는 시트를 활성화하고 Alt + F11 여는 열쇠 응용 프로그램 용 Microsoft Visual Basic 창.
2. 클릭 끼워 넣다 > 모듈 아래 코드를 스크립트에 붙여 넣습니다.
VBA : 날짜를 단어로 변환
Function DateToWords(ByVal xRgVal As Date) As String
' Update by Extendoffice on 20240926
Dim xYear As String
Dim Hundreds As String
Dim Decades As String
Dim xTensArr As Variant
Dim xOrdArr As Variant
Dim xCardArr As Variant
' Initialize arrays
xOrdArr = Array("First", "Second", "Third", "Fourth", "Fifth", "Sixth", _
"Seventh", "Eighth", "Ninth", "Tenth", "Eleventh", "Twelfth", _
"Thirteenth", "Fourteenth", "Fifteenth", "Sixteenth", _
"Seventeenth", "Eighteenth", "Nineteenth", "Twentieth", _
"Twenty-first", "Twenty-second", "Twenty-third", "Twenty-fourth", _
"Twenty-fifth", "Twenty-sixth", "Twenty-seventh", "Twenty-eighth", _
"Twenty-ninth", "Thirtieth", "Thirty-first")
xCardArr = Array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", _
"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", _
"Seventeen", "Eighteen", "Nineteen")
xTensArr = Array("Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety")
' Extract year
xYear = CStr(Year(xRgVal))
Decades = Mid$(xYear, 3)
' Handle decades
If CInt(Decades) < 20 Then
Decades = xCardArr(CInt(Decades))
Else
Decades = xTensArr(CInt(Left$(Decades, 1)) - 2) & "-" & xCardArr(CInt(Right$(Decades, 1)))
End If
' Handle hundreds
Hundreds = Mid$(xYear, 2, 1)
If CInt(Hundreds) Then
Hundreds = xCardArr(CInt(Hundreds)) & " Hundred "
Else
Hundreds = ""
End If
' Construct English representation of the date
DateToWords = xOrdArr(Day(xRgVal) - 1) & " " & Format$(xRgVal, "mmmm") & " " & _
xCardArr(CInt(Left$(xYear, 1))) & " Thousand " & Hundreds & Decades
End Function
3. 코드를 저장하고 시트로 돌아가서 결과를 출력 할 셀을 선택하고 다음 수식을 입력합니다. = DateToWords (A2) (A2은 사용하는 날짜입니다.) 엔터 버튼 키를 누르고 자동 채우기 핸들을 필요한 셀 위로 끕니다. 스크린 샷보기 :
Excel용 Kutools의 숫자를 단어로 변환 기능을 사용하여 Excel에서 숫자를 단어로 즉시 변환하는 편리함을 활용하여 전문적인 문서를 쉽게 만드는 데 시간과 노력을 절약하세요!
관련 기사 :
- Excel에서 유럽과 미국간에 날짜 형식을 빠르게 변환하는 방법은 무엇입니까?
- dD.MM.YYYY를 Excel에서 날짜 형식 (mM / DD / YYYY)으로 변환하는 방법은 무엇입니까?
- Excel에서 날짜와 Unix 타임 스탬프를 변환하는 방법은 무엇입니까?
최고의 사무 생산성 도구
🤖 | 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% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Sort comments by
#44981
This comment was minimized by the moderator on the site
0
0
#45004
This comment was minimized by the moderator on the site
Report
0
0
#42299
This comment was minimized by the moderator on the site
0
0
#40637
This comment was minimized by the moderator on the site
0
0
#40673
This comment was minimized by the moderator on the site
Report
0
0
#42300
This comment was minimized by the moderator on the site
0
0
#42433
This comment was minimized by the moderator on the site
Report
0
0
#40562
This comment was minimized by the moderator on the site
0
0
#38092
This comment was minimized by the moderator on the site
0
0
#35978
This comment was minimized by the moderator on the site
Report
0
0
#35790
This comment was minimized by the moderator on the site
0
0
#33808
This comment was minimized by the moderator on the site
0
0
#32834
This comment was minimized by the moderator on the site
0
0
#31944
This comment was minimized by the moderator on the site
0
0
#31945
This comment was minimized by the moderator on the site
Report
0
0
There are no comments posted here yet