Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() Quote:
|
#2
![]() |
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mon, 2 Jul 2012 14:49:01 +0000, Moideen wrote:
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 That makes perfect sense, given the specifications you have provided. ================ A : 1 B : 2 C : 3 D : 4 F : 5 ================================ It seems that you have only provided letter values for the numerals 1 to 5. And in a later post you indicated that you wanted the decimal (.) to be preserved. Why would you expect any other numerals to be taken into account? If you provide incomplete specifications, you should not be surprised that the results do not take into account requirements that you do not specify. I would suggest that, if there are other digits that you want to convert to letters, you include ALL of them in a single post. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Moideen wrote:
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 As I said before, you can extend the function by adding more levels of SUBSTITUTE or Replace as necessary -- meaning you need to *actually add another copy of the keyword*, not just the info to be replaced: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(SUBSTITUTE (A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F"),0,"S") If cell.Column = 1 Then cell.Offset(0, 1).Value = Replace(Replace( _ Replace(Replace(Replace(Replace(cell.Value, 1, "A"), 2, "B"), _ 3, "C"), 4, "D"), 5, "F"), 0, "S") If you need a seventh replacement, you need a seventh SUBSTITUTE/Replace... but this is going to get unwieldy pretty fast, especially if you're replacing *every* digit with a letter. If you have more than this, you should go back to looking the digits up in an array, similar (but not identical) to my first reply. -- Here is an idea for you geniuses: Point your weapons at the bugs and shoot. If they die, the guns work. If not, grab a brick. |
#5
![]() |
|||
|
|||
![]() Quote:
We Need Always 3 Digits.This function only comming 2 Digits, Pls Advice me on this matter. Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(SUBSTITUTE (A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F"),0,"S") |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Moideen wrote:
We Need Always 3 Digits.This function only comming 2 Digits, Pls Advice me on this matter. Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(SUBSTITUTE (A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F"),0,"S") Works for me. Shrug. Try switching to the VBA solution: 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(Replace(cell.Value, 1, "A"), 2, "B"), _ 3, "C"), 4, "D"), 5, "F"), 0, "S") Next End Sub -- Where is your savior now? |
#7
![]() |
|||
|
|||
![]() Quote:
Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS |
#8
![]() |
|||
|
|||
![]()
[quote=Auric__;1603366]Moideen wrote:
We Need Always 3 Digits.This function only comming 2 Digits, Pls Advice me on this matter. Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(SUBSTITUTE (A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F"),0,"S") Works for me. Shrug. Try switching to the VBA solution: 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(Replace(cell.Value, 1, "A"), 2, "B"), _ 3, "C"), 4, "D"), 5, "F"), 0, "S") Next End Sub -- I Tried with Above VBA code, Not Getting Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Moideen wrote:
Auric__;1603366 Wrote: Moideen wrote: - We Need Always 3 Digits.This function only comming 2 Digits, Pls Advice me on this matter. Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(SUBSTITUTE (A1,1,"A"),2,"B"),3,"C"),4,"D"),5,"F"),0,"S")- Works for me. Shrug. Try switching to the VBA solution: 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(Replace(cell.Value, 1, "A"), 2, "B"), _ 3, "C"), 4, "D"), 5, "F"), 0, "S") Next End Sub Not Getting.. Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS Then there's some difference between your system and mine, possibly something wrong. Everything that I've posted works as expected for me. -- SPIDERS! One had a name, even. |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Moideen wrote:
Not Getting.. Eg: 1.550 , Shown only : A.FF, To be Shown : A.FFS Okay, I've found the problem (which was in part due to me misunderstanding your problem). Use one of these: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(SUBSTITUTE(FIXED (A1,3,1),1,"A"),2,"B"),3,"C"),4,"D"),5,"F"),0,"S") ....or... 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(Replace(Format(cell.Value, "#.000"), _ 1, "A"), 2, "B"), 3, "C"), 4, "D"), 5, "F"), 0, "S") Next End Sub Note that both of these will *always* give you 3 decimal places, regardless of the source data: 1 A.SSS 1.55 A.FFS 2122.33333 BABB.CCC Also, both will remove any commas (thousands separators) from the number. -- She had accepted it once but now rejected it and could not give all of her reasons for this change. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto alphabetic | Excel Worksheet Functions | |||
HIghest Value - Numeric and Alphabetic | Excel Worksheet Functions | |||
how can I set up an alphabetic sequence? | Excel Discussion (Misc queries) | |||
Alphabetic autofill | Excel Discussion (Misc queries) | |||
alphabetic order | Excel Programming |