SlideShare a Scribd company logo
1 of 8
1.   Start Microsoft Excel.

      2.   Press ALT+F11 to start the Visual Basic Editor.
      3.   On the Insert menu, click Module.

      4.   Type the following code into the module sheet.

      5.   Finally you will get the conversion with spell rupees




'****************

  ' Main Function *

  '****************



  Function SpellRupee(ByVal MyNumber)

    Dim Dollars, Cents, Temp, Temp1, Dollars1, Temp2

    Dim DecimalPlace, Count



    ReDim Place(9) As String

    Place(2) = " THOUSAND "

    Place(3) = " Million "

    Place(4) = " Billion "

    Place(5) = " Trillion "



    ' 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

Temp2 = ""

If Len(MyNumber) > 7 Then

     Temp2 = GetHundreds(Left(MyNumber, Len(MyNumber) - 7)) & " CORES "

MyNumber = Right(MyNumber, 7)



End If



     Temp1 = ""

     If Len(MyNumber) > 5 Then

     Temp1 = GetHundreds(Left(MyNumber, Len(MyNumber) - 5)) & " LAKHS "

MyNumber = Right(MyNumber, 5)



     End If



     Do While MyNumber <> ""

         Temp = GetHundreds(Right(MyNumber, 3))

         If Temp <> "" Then Dollars1 = Temp & Place(Count) & Dollars1
If Len(MyNumber) > 3 Then

    MyNumber = Left(MyNumber, Len(MyNumber) - 3)

  Else

    MyNumber = ""

  End If

  Count = Count + 1

Loop

Dollars = Temp2 & Temp1 & Dollars1

Select Case Dollars

  Case ""

    Dollars = "NIL RUPEES"

  Case "One"

    Dollars = "ONE RUPEE "

  Case Else

    Dollars = " RUPEES " & Dollars & " ONLY "

End Select



Select Case Cents

  Case ""

    Cents = " "

  Case "One"

    Cents = " "

  Case Else

    Cents = " AND " & Cents & " PAISA"

End Select
SpellRupee = 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

    Result = GetNumber(Mid(MyNumber, 1, 1)) & " HUNDRED "

  End If



  ' Convert the tens and ones place.

  If Mid(MyNumber, 2, 1) <> "0" Then

    Result = Result & GetTens(Mid(MyNumber, 2))

  Else
Result = Result & GetNumber(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 = "TEN"

      Case 11: Result = "ELEVEN"

      Case 12: Result = "TWELVE"

      Case 13: Result = "THIRTEEN"

      Case 14: Result = "FOURTEEN"

      Case 15: Result = "FIFTEEN"

      Case 16: Result = "SIXTEEN"
Case 17: Result = "SEVENTEEN"

         Case 18: Result = "EIGHTEEN"

         Case 19: Result = "NINETEEN"

         Case Else

    End Select

  Else                     ' If value between 20-99...

    Select Case Val(Left(TensText, 1))

         Case 2: Result = "TWENTY "

         Case 3: Result = "THIRTY "

         Case 4: Result = "FORTY "

         Case 5: Result = "FIFTY "

         Case 6: Result = "SIXTY "

         Case 7: Result = "SEVENTY "

         Case 8: Result = "EIGHTY "

         Case 9: Result = "NINETY "

         Case Else

    End Select

    Result = Result & GetNumber _

         (Right(TensText, 1)) ' Retrieve ones place.

  End If

  GetTens = Result

End Function
'*******************************************

' Converts a number from 1 to 9 into text. *

'*******************************************



Private Function GetNumber(Digit)

  Select Case Val(Digit)

    Case 1: GetNumber = "ONE"

    Case 2: GetNumber = "TWO"

    Case 3: GetNumber = "THREE"

    Case 4: GetNumber = "FOUR"

    Case 5: GetNumber = "FIVE"

    Case 6: GetNumber = "SIX"

    Case 7: GetNumber = "SEVEN"

    Case 8: GetNumber = "EIGHT"

    Case 9: GetNumber = "NINE"

    Case Else: GetNumber = ""

  End Select

End Function
52 excel rupees converter formulae

More Related Content

Similar to 52 excel rupees converter formulae

PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
amrit47
 
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdfC# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
fazalenterprises
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorial
Gilkye
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
Mohamed Ahmed
 

Similar to 52 excel rupees converter formulae (20)

unction NumberToWords.docx
unction NumberToWords.docxunction NumberToWords.docx
unction NumberToWords.docx
 
Fungsi Terbilang Valid 100%
Fungsi Terbilang Valid 100%Fungsi Terbilang Valid 100%
Fungsi Terbilang Valid 100%
 
Terbilang
TerbilangTerbilang
Terbilang
 
ComEd101 - Chapter 2 Lesson 2.pptx
ComEd101 - Chapter 2 Lesson 2.pptxComEd101 - Chapter 2 Lesson 2.pptx
ComEd101 - Chapter 2 Lesson 2.pptx
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 
Swift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfSwift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdf
 
TEST DATA
TEST DATATEST DATA
TEST DATA
 
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdfC# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
 
Introduction to Kotlin.pptx
Introduction to Kotlin.pptxIntroduction to Kotlin.pptx
Introduction to Kotlin.pptx
 
01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorial
 
Decompiladores
DecompiladoresDecompiladores
Decompiladores
 
Programada chapter 4
Programada chapter 4Programada chapter 4
Programada chapter 4
 
Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
 
Python 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptxPython 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptx
 
208180 building-number-place-value
208180 building-number-place-value208180 building-number-place-value
208180 building-number-place-value
 
Vb file
Vb fileVb file
Vb file
 

Recently uploaded

Recently uploaded (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

52 excel rupees converter formulae

  • 1. 1. Start Microsoft Excel. 2. Press ALT+F11 to start the Visual Basic Editor. 3. On the Insert menu, click Module. 4. Type the following code into the module sheet. 5. Finally you will get the conversion with spell rupees '**************** ' Main Function * '**************** Function SpellRupee(ByVal MyNumber) Dim Dollars, Cents, Temp, Temp1, Dollars1, Temp2 Dim DecimalPlace, Count ReDim Place(9) As String Place(2) = " THOUSAND " Place(3) = " Million " Place(4) = " Billion " Place(5) = " Trillion " ' String representation of amount. MyNumber = Trim(Str(MyNumber)) ' Position of decimal place 0 if none. DecimalPlace = InStr(MyNumber, ".")
  • 2. ' 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 Temp2 = "" If Len(MyNumber) > 7 Then Temp2 = GetHundreds(Left(MyNumber, Len(MyNumber) - 7)) & " CORES " MyNumber = Right(MyNumber, 7) End If Temp1 = "" If Len(MyNumber) > 5 Then Temp1 = GetHundreds(Left(MyNumber, Len(MyNumber) - 5)) & " LAKHS " MyNumber = Right(MyNumber, 5) End If Do While MyNumber <> "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp <> "" Then Dollars1 = Temp & Place(Count) & Dollars1
  • 3. If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Dollars = Temp2 & Temp1 & Dollars1 Select Case Dollars Case "" Dollars = "NIL RUPEES" Case "One" Dollars = "ONE RUPEE " Case Else Dollars = " RUPEES " & Dollars & " ONLY " End Select Select Case Cents Case "" Cents = " " Case "One" Cents = " " Case Else Cents = " AND " & Cents & " PAISA" End Select
  • 4. SpellRupee = 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 Result = GetNumber(Mid(MyNumber, 1, 1)) & " HUNDRED " End If ' Convert the tens and ones place. If Mid(MyNumber, 2, 1) <> "0" Then Result = Result & GetTens(Mid(MyNumber, 2)) Else
  • 5. Result = Result & GetNumber(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 = "TEN" Case 11: Result = "ELEVEN" Case 12: Result = "TWELVE" Case 13: Result = "THIRTEEN" Case 14: Result = "FOURTEEN" Case 15: Result = "FIFTEEN" Case 16: Result = "SIXTEEN"
  • 6. Case 17: Result = "SEVENTEEN" Case 18: Result = "EIGHTEEN" Case 19: Result = "NINETEEN" Case Else End Select Else ' If value between 20-99... Select Case Val(Left(TensText, 1)) Case 2: Result = "TWENTY " Case 3: Result = "THIRTY " Case 4: Result = "FORTY " Case 5: Result = "FIFTY " Case 6: Result = "SIXTY " Case 7: Result = "SEVENTY " Case 8: Result = "EIGHTY " Case 9: Result = "NINETY " Case Else End Select Result = Result & GetNumber _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = Result End Function
  • 7. '******************************************* ' Converts a number from 1 to 9 into text. * '******************************************* Private Function GetNumber(Digit) Select Case Val(Digit) Case 1: GetNumber = "ONE" Case 2: GetNumber = "TWO" Case 3: GetNumber = "THREE" Case 4: GetNumber = "FOUR" Case 5: GetNumber = "FIVE" Case 6: GetNumber = "SIX" Case 7: GetNumber = "SEVEN" Case 8: GetNumber = "EIGHT" Case 9: GetNumber = "NINE" Case Else: GetNumber = "" End Select End Function