Personel & Zimmet Takip Programı (KZT-v.5) foruma eklenmiştir. 
http://www.excelce.net/forum/index.php?topic=1676.0

Gönderen Konu: Excel'de Rakamı Yazıya Çevirmek - (TL - Krş) Para Tutarını Yazıya Çevirmek  (Okunma sayısı 113294 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Bülent Öztürk

  • Excelce.Net Yönetici
  • *
  • İleti: 1411
  • Puan +19/-0
  • Cinsiyet: Bay
  • Türkçe Konuşup Excelce Yazıyoruz...
    • Bülent Öztürk
  • Ad Soyad: Bülent Öztürk
  • Doğum Yılınız: 1976
  • İl / İlçe: İstanbul / Çorlu
  • İşletim Sisteminiz: Win.10
  • Mesleğiniz: Bilgi Teknolojileri
  • Office Versiyonunuz: 2016
Aşağıdaki kodları kopyalayıp, bir modüle yapıştırın.

Kod: [Seç]
Public Function YAZIYACEVIR(Para_Tutar)

Dim Para_TutarStr As String
Dim ParaBirimi As String, ParaAltBirimi As String

HücreAdı = Para_Tutar.Address

If Para_Tutar = "" Then
YAZIYACEVIR = HücreAdı & " Hücresine bir değer girmelisiniz !..."
Exit Function
End If

If Not IsNumeric(Para_Tutar) Then
YAZIYACEVIR = HücreAdı & " Hücresine girilen değer, sayı değil !..."
Exit Function
End If

ParaStr = Format(Abs(Para_Tutar), "0.00")
ParaBirimi = Left(ParaStr, Len(ParaStr) - 3)
ParaAltBirimi = Right(ParaStr, 2)

YAZIYACEVIR = IIf(Para_Tutar = 0, "Yalnız " & Cevir(ParaBirimi) & " TL ", "") & _
IIf(Para_Tutar <> 0, "Yalnız ", "") & _
IIf(Para_Tutar < 0, "Eksi (-) ", "") & _
IIf(Para_Tutar <> 0, Cevir(ParaBirimi) & " TL ", "") & _
IIf(Val(ParaAltBirimi) <> 0, Cevir(ParaAltBirimi) & " Kr.", "")

If ParaBirimi = 0 And ParaAltBirimi > 0 Then
YAZIYACEVIR = "Yalnız " & Cevir(ParaAltBirimi) & " Kr."

If Para_Tutar < 0 And ParaAltBirimi > 0 Then
YAZIYACEVIR = "Yalnız Eksi (-) " & Cevir(ParaAltBirimi) & " Kr."

End If

End If

End Function

Private Function Cevir(SayiStr As String) As String

Dim Rakam(15)
Dim c(3), Sonuc, e

Birler = Array("", "bir", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz", "dokuz")
Onlar = Array("", "on", "yirmi", "otuz", "kırk", "elli", "altmış", "yetmiş", "seksen", "doksan")
Binler = Array("trilyon", "milyar", "milyon", "bin", "")

SayiStr = String(15 - Len(SayiStr), "0") + SayiStr

For i = 1 To 15
Rakam(i) = Val(Mid$(SayiStr, i, 1))
Next i

Sonuc = ""
For i = 0 To 4
c(1) = Rakam(i * 3 + 1)
c(2) = Rakam(i * 3 + 2)
c(3) = Rakam(i * 3 + 3)
If c(1) = 0 Then
e = ""
ElseIf c(1) = 1 Then
e = "yüz"
Else
e = Birler(c(1)) + "yüz"
End If
e = e + Onlar(c(2)) + Birler(c(3))
If e <> "" Then e = e + Binler(i)
If (i = 3) And (e = "birbin") Then e = "bin"
Sonuc = Sonuc + e
Next i

If Sonuc = "" Then Sonuc = "Sıfır"

Cevir = UCase(Mid(Sonuc, 1, 1)) + Mid(Sonuc, 2, Len(Sonuc) - 1)
End Function


Kullanımı:
=YAZIYACEVIR(HücreAdresi)
« Son Düzenleme: 22 Temmuz 2010, 10:04:52 Gönderen: Bülent Öztürk »
(Ücretli program talepleriniz için iletişime geçebilirsiniz, excelvbprogram@gmail.com)

Çevrimdışı Bülent Öztürk

  • Excelce.Net Yönetici
  • *
  • İleti: 1411
  • Puan +19/-0
  • Cinsiyet: Bay
  • Türkçe Konuşup Excelce Yazıyoruz...
    • Bülent Öztürk
  • Ad Soyad: Bülent Öztürk
  • Doğum Yılınız: 1976
  • İl / İlçe: İstanbul / Çorlu
  • İşletim Sisteminiz: Win.10
  • Mesleğiniz: Bilgi Teknolojileri
  • Office Versiyonunuz: 2016
Kod: [Seç]
Public Function ParaCevir(Para)
    Dim ParaStr As String
    Dim TL As String, Kurus As String
   
    If Not IsNumeric(Para) Then GoTo SayiDegil
   
    ParaStr = Format(Abs(Para), "0.00")
   
    TL = Left(ParaStr, Len(ParaStr) - 3)
    Kurus = Right(ParaStr, 2)
   
    ParaCevir = IIf(Para < 0, "Eksi ", "") & Cevir(TL) & " TL ve " & Cevir(Kurus) & " KURUŞ"
   
    Exit Function
   
SayiDegil:
    ParaCevir = "GİRİLEN DEĞER SAYI DEĞİL!"
End Function

Private Function Cevir(SayiStr As String) As String
    Dim Rakam(15)
    Dim c(3), Sonuc, e
   
    Birler = Array("", "bir", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz", "dokuz")
    Onlar = Array("", "on", "yirmi", "otuz", "kırk", "elli", "altmış", "yetmiş", "seksen", "doksan")
    Binler = Array("trilyon", "milyar", "milyon", "bin", "")
   
    SayiStr = String(15 - Len(SayiStr), "0") + SayiStr
   
    For i = 1 To 15
      Rakam(i) = Val(Mid$(SayiStr, i, 1))
    Next i
   
    Sonuc = ""
    For i = 0 To 4
      c(1) = Rakam(i * 3 + 1)
      c(2) = Rakam(i * 3 + 2)
      c(3) = Rakam(i * 3 + 3)
      If c(1) = 0 Then
        e = ""
      ElseIf c(1) = 1 Then
        e = "yüz"
      Else
        e = Birler(c(1)) + "yüz"
      End If
      e = e + Onlar(c(2)) + Birler(c(3))
      If e <> "" Then e = e + Binler(i)
      If (i = 3) And (e = "birbin") Then e = "bin"
      Sonuc = Sonuc + e
    Next i

    If Sonuc = "" Then Sonuc = "Sıfır"
   
    Cevir = UCase(Mid(Sonuc, 1, 1)) + Mid(Sonuc, 2, Len(Sonuc) - 1)
End Function

Kullanımı:
=ParaCevir(HücreAdresi)
« Son Düzenleme: 22 Temmuz 2010, 10:05:04 Gönderen: Bülent Öztürk »
(Ücretli program talepleriniz için iletişime geçebilirsiniz, excelvbprogram@gmail.com)

Çevrimdışı Bülent Öztürk

  • Excelce.Net Yönetici
  • *
  • İleti: 1411
  • Puan +19/-0
  • Cinsiyet: Bay
  • Türkçe Konuşup Excelce Yazıyoruz...
    • Bülent Öztürk
  • Ad Soyad: Bülent Öztürk
  • Doğum Yılınız: 1976
  • İl / İlçe: İstanbul / Çorlu
  • İşletim Sisteminiz: Win.10
  • Mesleğiniz: Bilgi Teknolojileri
  • Office Versiyonunuz: 2016
Kod: [Seç]
Option Explicit

'****************
' Main Function *
'****************
Function Oku(ByVal MyNumber)

Dim Dollars, Cents, Temp
Dim DecimalPlace, Count

ReDim Place(9) As String
Place(2) = " Bin "
Place(3) = " Milyon "
Place(4) = " Milyar "
Place(5) = " Trilyon "

' String representation of amount
MyNumber = Trim(Str(MyNumber))

' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
'Convert cents and set MyNumber to dollar amount
If DecimalPlace > 0 Then
Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If

Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then
If Count = 2 And Temp = "Bir" Then
Dollars = "Bin " & Dollars
Else
Dollars = Temp & Place(Count) & Dollars
End If

End If

If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop

Select Case Dollars
Case ""
Dollars = "Sıfır TL"
Case "One"
Dollars = "Bir TL"
Case Else
Dollars = Dollars & " TL"
End Select

Select Case Cents
Case ""
Cents = " "
Case "One"
Cents = " ve Bir KR"
Case Else
Cents = " ve " & Cents & " KR"
End Select

Oku = Dollars & Cents
End Function

'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Private Function GetHundreds(ByVal MyNumber)
Dim Result As String

If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)

'Convert the hundreds place
If Mid(MyNumber, 1, 1) <> "0" Then
If Mid(MyNumber, 1, 1) = "1" Then
Result = " Yüz "
Else
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Yüz "
End If
End If

'Convert the tens and ones place
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If

GetHundreds = Result
End Function

'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Private Function GetTens(TensText)
Dim Result As String

Result = "" 'null out the temporary function value
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19
Select Case Val(TensText)
Case 10: Result = "On"
Case 11: Result = "Onbir"
Case 12: Result = "Oniki"
Case 13: Result = "Onüç"
Case 14: Result = "Ondört"
Case 15: Result = "Onbeş"
Case 16: Result = "Onaltı"
Case 17: Result = "Onyedi"
Case 18: Result = "Onsekiz"
Case 19: Result = "Ondokuz"
Case Else
End Select
Else ' If value between 20-99
Select Case Val(Left(TensText, 1))
Case 2: Result = "Yirmi "
Case 3: Result = "Otuz "
Case 4: Result = "Kırk "
Case 5: Result = "Elli "
Case 6: Result = "Altmış "
Case 7: Result = "Yetmiş "
Case 8: Result = "Seksen "
Case 9: Result = "Doksan "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) 'Retrieve ones place
End If
GetTens = Result
End Function

'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Private Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "Bir"
Case 2: GetDigit = "İki"
Case 3: GetDigit = "Üç"
Case 4: GetDigit = "Dört"
Case 5: GetDigit = "Beş"
Case 6: GetDigit = "Altı"
Case 7: GetDigit = "Yedi"
Case 8: GetDigit = "Sekiz"
Case 9: GetDigit = "Dokuz"
Case Else: GetDigit = ""
End Select
End Function


Kullanımı:
=oku(HücreAdresi)
« Son Düzenleme: 22 Temmuz 2010, 10:05:15 Gönderen: Bülent Öztürk »
(Ücretli program talepleriniz için iletişime geçebilirsiniz, excelvbprogram@gmail.com)