Բաց թողնել հիմնական բովանդակությունը

Ինչպե՞ս Excel- ում ամսաթիվը արագ փոխել բառերի:

Ընդհանուր առմամբ, մենք սովորաբար Excel- ում ամսաթիվը վերափոխում ենք ամսաթվի այլ ձևաչափերի կամ թվանշանների, բայց երբևէ երբևէ բախվե՞լ եք ամսաթվի անգլերեն բառերի վերածելու խնդրի հետ, ինչպես ցույց է տրված ստորև նշված էկրանի նկարը: Իրականում, չկա ներկառուցված գործառույթ, որը կարող է կարգավորել այն, այլ VBA կոդ:
փաստաթղթի ամսաթիվը բառերի համար 1

Ամսաթիվը բառի փոխարկեք Սահմանված գործառույթի հետ


Ամսաթիվը բառի փոխարկեք Սահմանված գործառույթի հետ

Ահա մակրո կոդ, որը կարող է ձեզ լավություն ցույց տալ ամսաթվերը բառերի վերածելու հարցում:

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


փաստաթղթի ամսաթիվը բառերի համար 2

3. Պահպանեք կոդը և վերադարձեք թերթիկ, ընտրեք այն բջիջը, որի արդյունքը դուրս կգաք, մուտքագրեք այս բանաձևը = DateToWords (A2) (A2- ը ձեր օգտագործման ամսաթիվն է), սեղմեք Մտնել բանալին և ավտոմատ լրացնելու բռնիչը քաշեք դեպի ձեզ անհրաժեշտ բջիջները: Տեսեք,
փաստաթղթի ամսաթիվը բառերի համար 3փաստաթղթի ամսաթիվը բառերի համար 4


Բացեք Excel-ում թվերը բառերի ակնթարթորեն փոխակերպելու հարմարությունը Kutools-ի համար Excel-ի համարներ բառերի հատկությամբ՝ խնայելով ձեր ժամանակն ու ջանքը՝ առանց ջանքերի պրոֆեսիոնալ տեսք ունեցող փաստաթղթեր ստեղծելու համար:

Գնացեք Անվճար Ներբեռնում հիմա


Հարաբերական հոդվածներ:

Գրասենյակի արտադրողականության լավագույն գործիքները

🤖 Kutools AI օգնականՀեղափոխություն կատարել տվյալների վերլուծության հիման վրա՝ Խելացի կատարում   |  Ստեղծեք ծածկագիր  |  Ստեղծեք հատուկ բանաձևեր  |  Վերլուծել տվյալները և ստեղծել գծապատկերներ  |  Invoke Kutools-ի գործառույթները...
Հանրաճանաչ հատկություններ: Գտեք, ընդգծեք կամ նույնականացրեք կրկնօրինակները   |  Deleteնջել դատարկ շարքերը   |  Միավորել սյունակները կամ բջիջները՝ առանց տվյալների կորստի   |   Կլոր առանց բանաձևի ...
Super Փնտրել: Բազմաթիվ չափանիշների VLookup    Բազմակի արժեք VLookup  |   VLookup բազմաթիվ թերթերում   |   Fuzzy Փնտրել ....
Ընդլայնված բացվող ցուցակ: Արագ ստեղծեք բացվող ցուցակը   |  Կախված բացվող ցուցակ   |  Բազմակի ընտրություն Drop Down ցուցակ ....
Սյունակի կառավարիչ: Ավելացրեք որոշակի քանակությամբ սյունակներ  |  Տեղափոխել սյունակները  |  Փոխարկել թաքնված սյունակների տեսանելիության կարգավիճակը  |  Համեմատեք միջակայքերը և սյունակները ...
Առանձնահատկություններ: Ցանցի կենտրոնացում   |  Դիզայնի տեսք   |   Մեծ Formula Bar    Աշխատանքային գրքույկի և թերթիկների կառավարիչ   |  Ռեսուրսների գրադարան (Ավտոմատ տեքստ)   |  Ամսաթիվ ընտրող   |  Միավորել աշխատանքային թերթերը   |  Գաղտնագրել/գաղտնազերծել բջիջները    Ուղարկեք նամակներ ըստ ցանկի   |  Սուպեր զտիչ   |   Հատուկ զտիչ (զտել թավ/շեղ/շեղված...) ...
Լավագույն 15 գործիքների հավաքածու12 Տեքստ Գործիքներ (Ավելացրեք տեքստ, Հեռացնել նիշերը, ...)   |   50+ Աղյուսակ Տեսակներ (Գանտի աղյուսակը, ...)   |   40+ Գործնական Բանաձեւեր (Հաշվարկել տարիքը ՝ ելնելով ծննդյան տարեդարձից, ...)   |   19 միացում Գործիքներ (Տեղադրեք QR կոդ, Տեղադրեք նկար ուղուց, ...)   |   12 Փոխարկում Գործիքներ (Բառեր համարներ, Արտարժույթի փոխակերպումը, ...)   |   7 Միաձուլում և պառակտում Գործիքներ (Ընդլայնված կոմբինատ տողեր, Պառակտված բջիջներ, ...)   |   ... եւ ավելին

Լրացրեք ձեր Excel-ի հմտությունները Kutools-ի հետ Excel-ի համար և փորձեք արդյունավետությունը, ինչպես երբեք: Kutools-ը Excel-ի համար առաջարկում է ավելի քան 300 առաջադեմ առանձնահատկություններ՝ արտադրողականությունը բարձրացնելու և ժամանակ խնայելու համար:  Սեղմեք այստեղ՝ Ձեզ ամենաշատ անհրաժեշտ հատկանիշը ստանալու համար...

Նկարագրություն


Office Tab- ը Tabbed ինտերֆեյսը բերում է Office, և ձեր աշխատանքը շատ ավելի դյուրին դարձրեք

  • Միացնել ներդիրներով խմբագրումը և ընթերցումը Word, Excel, PowerPoint- ով, Հրատարակիչ, Access, Visio և Project:
  • Բացեք և ստեղծեք բազմաթիվ փաստաթղթեր նույն պատուհանի նոր ներդիրներում, այլ ոչ թե նոր պատուհաններում:
  • Բարձրացնում է ձեր արտադրողականությունը 50%-ով և նվազեցնում մկնիկի հարյուրավոր սեղմումները ձեզ համար ամեն օր:
Comments (25)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
The spelling of 9th is wrong. It's written Nineth, but it should be Ninth.
This comment was minimized by the moderator on the site
Thank you for your message. I have corrected and updated the code accordingly. Thank you.
This comment was minimized by the moderator on the site
07/08/1998 SEVENTH AUGUST TWENTY HUNDRED NINETY-EIGHT
In this vba have error
convert it1998 but it shows TWENTY HUNDRED NINETY-EIGHT
This comment was minimized by the moderator on the site
07/08/1998 SEVENTH AUGUST NINETEEN HUNDRED NINETY EIGHT
I need dob into words in upper format but i use this micros in excel i got this
07/08/1998 SEVENTH AUGUST ONE THOUSAND NINE HUNDRED NINETY-EIGHT which is not usefull
This comment was minimized by the moderator on the site
Hi, MAX, I have modified the VBA, please try and let me know if it works. Thanks.
Function DateToWords(ByVal xRgVal As Date) As String
'UpdatebyExtendoffice20170926
    Dim xYear As String
    Dim Decades As String
    Dim years As String
    Dim xTensArr As Variant
    Dim xyearArr As Variant
    Dim xOrdArr As Variant
    Dim xCardArr As Variant
    xOrdArr = Array("First", "Second", "Third", _
                   "Fourth", "Fifth", "Sixth", _
                   "Seventh", "Eighth", "Nineth", _
                   "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-nineth", "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")
    xYear = CStr(Year(xRgVal))
    
    
      xyearArr = Array("", "One", "Two", "Three", "Four", _
                   "Five", "Six", "Seven", "Eight", "Nine", _
                   "Ten", "Eleven", "Twelve", "Thirteen", _
                   "Fourteen", "Fifteen", "Sixteen", _
                   "Seventeen", "Eighteen", "Nineteen", "Twenty", "Thirty", "Forty", "Fifty", _
               "Sixty", "Seventy", "Eighty", "Ninety")

    years = xyearArr(CInt(Year(xRgVal) / 100)) & " Hundred"
    
    Decades = Mid$(xYear, 3)
    If CInt(Decades) < 20 Then
        Decades = xCardArr(CInt(Decades))
    Else
        Decades = xTensArr(CInt(Left$(Decades, 1)) - 2) & "-" & _
                xCardArr(CInt(Right$(Decades, 1)))
    End If

    DateToWords = UCase(xOrdArr(Day(xRgVal) - 1) & _
                  Format$(xRgVal, " mmmm ") & _
                  years & " " & Decades)
End Function

This comment was minimized by the moderator on the site
07/08/1998 SEVENTH AUGUST TWENTY HUNDRED NINETY-EIGHT
In this vba have error
convert it1998 but it shows TWENTY HUNDRED NINETY-EIGHT
This comment was minimized by the moderator on the site
Hi, try this vba:
Function DateToWords(ByVal xRgVal As Date) As String
'UpdatebyExtendoffice20170926
    Dim xYear As String
    Dim Decades As String
    Dim years As String
    Dim xTensArr As Variant
    Dim xyearArr As Variant
    Dim xOrdArr As Variant
    Dim xCardArr As Variant
    xOrdArr = Array("First", "Second", "Third", _
                   "Fourth", "Fifth", "Sixth", _
                   "Seventh", "Eighth", "Nineth", _
                   "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-nineth", "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")
    xYear = CStr(Year(xRgVal))
    
    
      xyearArr = Array("", "One", "Two", "Three", "Four", _
                   "Five", "Six", "Seven", "Eight", "Nine", _
                   "Ten", "Eleven", "Twelve", "Thirteen", _
                   "Fourteen", "Fifteen", "Sixteen", _
                   "Seventeen", "Eighteen", "Nineteen", "Twenty", "Thirty", "Forty", "Fifty", _
               "Sixty", "Seventy", "Eighty", "Ninety")

    years = xyearArr(Fix(Year(xRgVal) / 100)) & " Hundred"
    
    Decades = Mid$(xYear, 3)
    If CInt(Decades) < 20 Then
        Decades = xCardArr(CInt(Decades))
    Else
        Decades = xTensArr(CInt(Left$(Decades, 1)) - 2) & "-" & _
                xCardArr(CInt(Right$(Decades, 1)))
    End If

    DateToWords = UCase(xOrdArr(Day(xRgVal) - 1) & _
                  Format$(xRgVal, " mmmm ") & _
                  years & " " & Decades)
End Function

This comment was minimized by the moderator on the site
آپ کا بہت شکریہ
This comment was minimized by the moderator on the site
It is giving the #NAME? Error
This comment was minimized by the moderator on the site
I would like to add text to the output, for instance, 1958 gets converted to One Thousand Nineteen Hundred Fifty Eight and I would like it to say One Thousand Nineteen Hundred and Fifty Eight. Can someone give me an example of how I can do this please?
This comment was minimized by the moderator on the site
thank u for helping me . very useful in converting date of birth in word
This comment was minimized by the moderator on the site
Sir/Madam

It is very useful for me.

Really Amazing and helped to solve the problem within a minute.

Thank you for uploading this document. Very nice
This comment was minimized by the moderator on the site
how to use this code in vb6 for a textbox
This comment was minimized by the moderator on the site
date to word in gujarati language avilable ? please answer me. 9427909038
This comment was minimized by the moderator on the site
I think it does not work for other languages except english.
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