Computers & Internet Logo

Related Topics:

Anonymous Posted on Jul 09, 2009

In MS Excel, convert a Number in Text formate

In MS Excel, I want to convert a number in a cell to text format in another cell. The formate should be like - "Rs. .. Crores .. Lacs .. Thousand . Hundred . . and . . Paise Only" How can I get this?

1 Answer

Anonymous

Level 1:

An expert who has achieved level 1.

  • Contributor 1 Answer
  • Posted on Jul 09, 2009
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

Joined: Jul 09, 2009
Answers
1
Questions
0
Helped
504
Points
1

Dear,

you've use macro to this.

Press Alt+F11
it will open Microsoft Vsual Basic Editor.

Click on Module in Insert Menu and paste the following codings:

Function ConvRs(ByVal MyNumber)
Dim Rupees, Paise, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Lac "
Place(4) = " Crore "
Place(5) = " Arab " ' String representation of amount
MyNumber = Trim(Str(MyNumber)) ' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
' Convert Paise and set MyNumber to Rupee amount
If DecimalPlace > 0 Then
Paise = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
If Count = 1 Then Temp = GetHundreds(Right(MyNumber, 3))
If Count > 1 Then Temp = GetHundreds(Right(MyNumber, 2))
If Temp <> "" Then Rupees = Temp & Place(Count) & Rupees
If Count = 1 And Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
If Count > 1 And Len(MyNumber) > 2 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 2)
Else
MyNumber = ""
End If
End If
Count = Count + 1
Loop
Select Case Rupees
Case ""
Rupees = "No Rupees"
Case "One"
Rupees = "One Rupee"
Case Else

'Rupees = Rupees & " Rupees"
Rupees = "Rupees " & Rupees

End Select
Select Case Paise
Case ""

'Paise = ""
Paise = " Only"
Case "One"
Paise = " and One Paisa"
Case Else
Paise = " and " & Paise & " Paise"

End Select
ConvRs = Rupees & Paise
End Function
'***************************************...
' Converts a number from 100-999 into text *
'***************************************...
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 = GetDigit(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 & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function
'***************************************...
' Converts a number from 10 to 99 into text. *
'***************************************...
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 & GetDigit _
(Right(TensText, 1)) 'Retrieve ones place
End If
GetTens = Result
End Function
'***************************************...
' Converts a number from 1 to 9 into text. *
'***************************************...
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function



save this as as ConvertRs.xla in Microsoft\AddIns folder

now, you'll have to activate this AddIns:
in your Excel Worksheet select:
Tools\Add.Ins...
Check the ConvertRs option
now this will be used as User Defined Function.
you can insert it from the Function Options or just enter the following command in the desired cell where you want the result:

=ConvertRs(Cell Reference)

Cell Reference means where the number is available, you want to convert.

Try this and then tell me the responce.

Bhasker Kumar

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

0helpful
1answer

What is formatting cells in Microsoft Excel

formatting is controlling how the cells and their contents appear.
It may be the colour of the cells, the position of any text in the cell, the size of the cell, or of the text within it, it may be how the text is displayed, eg, as a number 1234 or as text '1234', or a time/date or a currency $1234.00 or in a different format $1,234.00

I hope this has at least given you some idea of what is meant by formatting.


14.August.2014
0helpful
1answer

Hi, I am trying to change an excel spreadsheet. There are unit numbers on the spreadsheet which have converted themseles to dates ie 4/52 has now become Apr-52. I have tried everythiong to change it but...

Right-click the cells and go to 'Format Cells'. Then, select the correct format. If you're wanting to leave the slash (/) in the number, you'll probably have to make it a text format.
0helpful
1answer

MS Excel 2004 for Mac file returning "0" as answer. Same formulas in above cells are functioning properly.

Please check if cell format in MAC is text, if it is text, please convert it to numeric.
2helpful
2answers

Convert function

BAHTTEXT(number)

The above function will convert a number to text. If you are referring to "figure" as a number than this should work for you.

You may want to try the TEXT(value,format_text) fucntion too but you'll need to supply a number format.
0helpful
2answers

FORMULA PROBLEM IN MS EXCEL

The cells you are trying to sum are probably text and not numeric values. Format them as number or convert them to numbers.
0helpful
1answer

Write into excel format

You can use ADO or SQL to open the excel file directly (provided it is constructed correctly, ie fields names) and write the data to it without Access.
That might be eaiser thatn converting it from Access to Excel, if that can even be done.
0helpful
1answer

How to seperate a number from a text string in microsoft excel?

highlite the cells you want. right click the mouse. go to format. select text in the first coloumn.
highlite the cells you want for the second column, right click the mouse and go to format and select number and no decimal.
0helpful
1answer

Need Formula

TEXT CASE
Convert to UPPER, Proper or lower
Auto Convert to UPPER, Proper or lower
Stop VBA Being Case Sensitive

SELECT CASE VBA
Select Case Statement. Great alternative to Else If Statements

CONVERSION
VBA: CBool(),CByt(),CCur(),CDate(),CDbl()Double,CDec(),CInt(),CLng(),CSng(),CStr(),CVar().
Example
dDate=cDate("25-Jan-07")
Convert Numbers to Words
Convert Numbers to Dollar Amount in Words
Spreadsheet Converter. Versions: HTML/JavaScript,Excel ASP.Net and Excel Java/JSP. $
SQL Database Migration $
Converters. Database Converters, Spreadsheet Converters, Text Converters, E-mail Conversion, Document Conversion, PDF Conversion and more! $
CSV Converter $

IMPORTING
Import SQL Into Excel-SQL Tester $
Import Excel Into Access $

CONDITIONAL FORMATTING
Conditional Formatting
More Than 3 Conditional Formats
Conditional Format Fonts for greater than 3

CUSTOM FORMATS
Custom Formats
Excel see a cells format as having four Sections. These are, from left to right: Positives;Negatives;Zeros;Text.

To hide zeros cell-by-cell use a Custom Number Format like 0.00;-0.00; where 0.00 is desired format for non zeros. Note the use of -0.00 for negatives.

To hide zeros on the Workbook level go to Tools>Options>View - Zero Values.
0helpful
3answers

CONVERSION OF NUMERICAL VALUE INTO TEXT IN M.S. EXCEL

to convert numbers into text, just add an apostrophe ' to the left of the number. When you press enter, the apostrophe will no appear, but the number will have the atrtibutes of text
0helpful
2answers

Conversion from date to text formet

Block off the cells (or row or column) in question, right-click and choose FORMAT CELLS. In the NUMBER tab, choose TEXT. This will make your dates appear exactly as they are typed, and not allow Excel to reformat them.
Not finding what you are looking for?

514 views

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

Grand Canyon Tech
Grand Canyon Tech

Level 3 Expert

3867 Answers

k24674

Level 3 Expert

8093 Answers

Brad Brown

Level 3 Expert

19187 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...