Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 36
Default To be got Alphabetic

We are Maintaining cost in English Letters, Kindly Help to get COST on Coloumn2

Examples,

A : 1
B : 2
C : 3
D : 4
F : 5

If I Entered 242 on Coloumn1 Need Automatic Shown BDB on Coloumn2
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 259
Default To be got Alphabetic

On 29/06/2012 10:53 PM, Moideen wrote:
We are Maintaining cost in English Letters, Kindly Help to get COST on
Coloumn2

Examples,

A : 1
B : 2
C : 3
D : 4
F : 5

If I Entered 242 on Coloumn1 Need Automatic Shown BDB on Coloumn2




Well

I don't quiet follow what you mean by COST on Column 2 as your end
statement, you are asking for "BDB" to be shown if 242 is entered into
the adjacent cell in Column 1

FWIW:

if A2 is the active cell, then in B2 this:

=IF($A2=242,"BDB","")

Copy down as required..

HTH
Mick.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default To be got Alphabetic

Moideen wrote:

We are Maintaining cost in English Letters, Kindly Help to get COST on
Coloumn2

Examples,

A : 1
B : 2
C : 3
D : 4
F : 5

If I Entered 242 on Coloumn1 Need Automatic Shown BDB on Coloumn2


Put this in the sheet's object in the VBA editor:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range, outP As String, costs As Variant
costs = Array("#", "A", "B", "C", "D", "F", "#", "#", "#", "#")
For Each cell In Target
If cell.Column = 1 Then
outP = ""
c = Abs(Val(cell.Value))
Do While c 0
n = c Mod 10
c = c \ 10
outP = costs(n) & outP
Loop
Me.Cells(cell.Row, cell.Column + 1).Value = outP
End If
Next
End Sub

Edit the 'costs' array to fit. (The hashes are there to indicate data entry
errors. If you don't want them, don't delete them -- change them to "".)

If this is meant to apply to the entire workbook, put this in the
ThisWorkbook object instead:

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Dim cell As Range, outP As String, costs As Variant
costs = Array("#", "A", "B", "C", "D", "F", "#", "#", "#", "#")
For Each cell In Target
If cell.Column = 1 Then
outP = ""
c = Abs(Val(cell.Value))
Do While c 0
n = c Mod 10
c = c \ 10
outP = costs(n) & outP
Loop
Sh.Cells(cell.Row, cell.Column + 1).Value = outP
End If
Next
End Sub

--
Money and faith are powerful motivators.
  #4   Report Post  
Member
 
Posts: 36
Default

Quote:
Originally Posted by Auric__ View Post
Moideen wrote:

We are Maintaining cost in English Letters, Kindly Help to get COST on
Coloumn2

Examples,

A : 1
B : 2
C : 3
D : 4
F : 5

If I Entered 242 on Coloumn1 Need Automatic Shown BDB on Coloumn2


Put this in the sheet's object in the VBA editor:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range, outP As String, costs As Variant
costs = Array("#", "A", "B", "C", "D", "F", "#", "#", "#", "#")
For Each cell In Target
If cell.Column = 1 Then
outP = ""
c = Abs(Val(cell.Value))
Do While c 0
n = c Mod 10
c = c \ 10
outP = costs(n) & outP
Loop
Me.Cells(cell.Row, cell.Column + 1).Value = outP
End If
Next
End Sub

Edit the 'costs' array to fit. (The hashes are there to indicate data entry
errors. If you don't want them, don't delete them -- change them to "".)

If this is meant to apply to the entire workbook, put this in the
ThisWorkbook object instead:

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Dim cell As Range, outP As String, costs As Variant
costs = Array("#", "A", "B", "C", "D", "F", "#", "#", "#", "#")
For Each cell In Target
If cell.Column = 1 Then
outP = ""
c = Abs(Val(cell.Value))
Do While c 0
n = c Mod 10
c = c \ 10
outP = costs(n) & outP
Loop
Sh.Cells(cell.Row, cell.Column + 1).Value = outP
End If
Next
End Sub

--
Money and faith are powerful motivators.
Dear Auric,

Thank you very much, This function working is smoothly but one problem,
If i entered 12.3 , Need Letter : AB.C or AB/C Please Help me.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default To be got Alphabetic

Moideen wrote:

Auric__ Wrote:
Moideen wrote:
-
We are Maintaining cost in English Letters, Kindly Help to get COST
on Coloumn2

Examples,

A : 1
B : 2
C : 3
D : 4
F : 5

If I Entered 242 on Coloumn1 Need Automatic Shown BDB on Coloumn2-


Put this in the sheet's object in the VBA editor:

[snip]
Edit the 'costs' array to fit. (The hashes are there to indicate data
entry errors. If you don't want them, don't delete them -- change them
to "".)

If this is meant to apply to the entire workbook, put this in the
ThisWorkbook object instead:

[snip]
Thank you very much, This function working is smoothly but one problem,
If i entered 12.3 , Need Letter : AB.C or AB/C Please Help me.


I looked through the functions, and found the SUBSTITUTE spreadsheet
function. It should be faster than my code, and should also be easier to
understand. Paste this into B1 and then copy down (one line, watch the word
wrap):

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE
(A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F")

This can be extended by adding on more levels of SUBSTITUTE if necessary.

If you'd rather stick with VBA, this works similarly:

Private Sub Worksheet_Change(ByVal Target As Range)
For Each cell In Target
If cell.Column = 1 Then cell.Offset(0, 1).Value = Replace(Replace( _
Replace(Replace(Replace(cell.Value, 1, "A"), 2, "B"), 3, "C"), _
4, "D"), 5, "F")
Next
End Sub

(Forget about what I posted before. Wasted effort on my part, mostly.)

--
I don't believe in *lots* of invisible things
that are supposed to make me happy.


  #6   Report Post  
Member
 
Posts: 36
Default

Quote:
Originally Posted by Auric__ View Post
Moideen wrote:

Auric__ Wrote:
Moideen wrote:
-
We are Maintaining cost in English Letters, Kindly Help to get COST
on Coloumn2

Examples,

A : 1
B : 2
C : 3
D : 4
F : 5

If I Entered 242 on Coloumn1 Need Automatic Shown BDB on Coloumn2-


Put this in the sheet's object in the VBA editor:

[snip]
Edit the 'costs' array to fit. (The hashes are there to indicate data
entry errors. If you don't want them, don't delete them -- change them
to "".)

If this is meant to apply to the entire workbook, put this in the
ThisWorkbook object instead:

[snip]
Thank you very much, This function working is smoothly but one problem,
If i entered 12.3 , Need Letter : AB.C or AB/C Please Help me.


I looked through the functions, and found the SUBSTITUTE spreadsheet
function. It should be faster than my code, and should also be easier to
understand. Paste this into B1 and then copy down (one line, watch the word
wrap):

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE
(A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F")

This can be extended by adding on more levels of SUBSTITUTE if necessary.

If you'd rather stick with VBA, this works similarly:

Private Sub Worksheet_Change(ByVal Target As Range)
For Each cell In Target
If cell.Column = 1 Then cell.Offset(0, 1).Value = Replace(Replace( _
Replace(Replace(Replace(cell.Value, 1, "A"), 2, "B"), 3, "C"), _
4, "D"), 5, "F")
Next
End Sub

(Forget about what I posted before. Wasted effort on my part, mostly.)

--
I don't believe in *lots* of invisible things
that are supposed to make me happy.
Thanks a lot...
  #7   Report Post  
Member
 
Posts: 36
Default

Quote:
Originally Posted by Moideen View Post
Thanks a lot...
Dear Auric,

I Tried with the below mentioned VBA code "0" not showing.

Eg : 1.550 , Shown only : A.FF, To be Shown : A.FFS

Private Sub Worksheet_Change(ByVal Target As Range)
For Each cell In Target
If cell.Column = 1 Then cell.Offset(0, 1).Value = Replace(Replace( _
Replace(Replace(Replace(cell.Value, 1, "A"), 2, "B"), 3, "C"), _
4, "D"), 5, "F"), 0, "S")
Next
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto alphabetic [email protected] Excel Worksheet Functions 1 November 27th 07 04:30 PM
HIghest Value - Numeric and Alphabetic De-coi via OfficeKB.com Excel Worksheet Functions 2 December 7th 06 12:01 PM
how can I set up an alphabetic sequence? JackLWinans Excel Discussion (Misc queries) 2 May 1st 06 06:25 PM
Alphabetic autofill dogisnuts Excel Discussion (Misc queries) 3 June 17th 05 03:16 AM
alphabetic order adm1 Excel Programming 0 December 18th 03 09:26 PM


All times are GMT +1. The time now is 06:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"