Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bramruis via OfficeKB.com
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

My cells in a column are filled with amounts for
which I have to change the last digit into a letter.
E.g. if last digit is 1 and the amount is positive it should be changed into
an A if it's negative it should be changed in a J
If the last digit is 2 and the amount is positive it should be changed into a
B, if it's negative it should be changed into a K.
If the last digit is 3 and the amount is positive it should be changed into a
C, it it's negative it should be changed into a L.
And so on.

I tried to use this formula but I'm hitting the 7 nested functions ceiling
because I need to change the last digits 0-9 both positive and negative.
Example: =IF(J40,REPLACE(J4,LEN(J4),1,IF(RIGHT(J4,1)="1"," A",IF(RIGHT(J4,1)
="2","B",IF(RIGHT(J4,1)="3","C",IF(RIGHT(J4,1)="4" ,"E"))))))

Is there any other way you can think of?
Thanks.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200510/1
  #2   Report Post  
Gary76
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

Something like:

=IF(J4<0,LEFT(J4,LEN(J4)-1)&VLOOKUP(RIGHT(J4,1)*1,$N$2:$P$10,3,0),IF(J40,L EFT(J4,LEN(J4)-1)&VLOOKUP(RIGHT(J4,1)*1,$N$2:$P$10,2,0),""))

In column N2:N10 1 - 9
In column O2:O10 A - I
In column P2:P10 J - R

HTH

"bramruis via OfficeKB.com" wrote:

My cells in a column are filled with amounts for
which I have to change the last digit into a letter.
E.g. if last digit is 1 and the amount is positive it should be changed into
an A if it's negative it should be changed in a J
If the last digit is 2 and the amount is positive it should be changed into a
B, if it's negative it should be changed into a K.
If the last digit is 3 and the amount is positive it should be changed into a
C, it it's negative it should be changed into a L.
And so on.

I tried to use this formula but I'm hitting the 7 nested functions ceiling
because I need to change the last digits 0-9 both positive and negative.
Example: =IF(J40,REPLACE(J4,LEN(J4),1,IF(RIGHT(J4,1)="1"," A",IF(RIGHT(J4,1)
="2","B",IF(RIGHT(J4,1)="3","C",IF(RIGHT(J4,1)="4" ,"E"))))))

Is there any other way you can think of?
Thanks.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200510/1

  #3   Report Post  
Stefi
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

Use a Helper sheet, format A-C columns as text:
A1-A10: 1-0
B1-B10: A-J
C1-C10: K-T

In your example there was no place for digit 0!

Your amount is, say, in A1, then in B1:
=LEFT(A1,LEN(A1)-1) & VLOOKUP(RIGHT(A1,1),Helper!A1:C10,IF(A10,2,3),FAL SE)


"bramruis via OfficeKB.com" wrote:

My cells in a column are filled with amounts for
which I have to change the last digit into a letter.
E.g. if last digit is 1 and the amount is positive it should be changed into
an A if it's negative it should be changed in a J
If the last digit is 2 and the amount is positive it should be changed into a
B, if it's negative it should be changed into a K.
If the last digit is 3 and the amount is positive it should be changed into a
C, it it's negative it should be changed into a L.
And so on.

I tried to use this formula but I'm hitting the 7 nested functions ceiling
because I need to change the last digits 0-9 both positive and negative.
Example: =IF(J40,REPLACE(J4,LEN(J4),1,IF(RIGHT(J4,1)="1"," A",IF(RIGHT(J4,1)
="2","B",IF(RIGHT(J4,1)="3","C",IF(RIGHT(J4,1)="4" ,"E"))))))

Is there any other way you can think of?
Thanks.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200510/1

  #4   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

On Wed, 26 Oct 2005 08:24:44 GMT, "bramruis via OfficeKB.com" <u15176@uwe
wrote:

My cells in a column are filled with amounts for
which I have to change the last digit into a letter.
E.g. if last digit is 1 and the amount is positive it should be changed into
an A if it's negative it should be changed in a J
If the last digit is 2 and the amount is positive it should be changed into a
B, if it's negative it should be changed into a K.
If the last digit is 3 and the amount is positive it should be changed into a
C, it it's negative it should be changed into a L.
And so on.

I tried to use this formula but I'm hitting the 7 nested functions ceiling
because I need to change the last digits 0-9 both positive and negative.
Example: =IF(J40,REPLACE(J4,LEN(J4),1,IF(RIGHT(J4,1)="1"," A",IF(RIGHT(J4,1)
="2","B",IF(RIGHT(J4,1)="3","C",IF(RIGHT(J4,1)="4 ","E"))))))

Is there any other way you can think of?
Thanks.


You're description is inconsistent since it seems as if you want to convert
digits 0-9, yet if you have 1 = A or J depending on positive or negative, it's
not clear what you want to do if the last digit is zero.

So I changed your specifications so that 0 -- A or K; 1 -- B or L; etc.

You can do that with the formula:

=LEFT(A1,LEN(A1)-1)&CHAR(RIGHT(A1,1)+65+10*(A1<0))


--ron
  #5   Report Post  
bramruis via OfficeKB.com
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

Yes, sorry. You're right.
Here are the values that I need:

Last digit: Positive value: Negative value:

0 { }
1 A J
2 B K
3 C L
4 D M
5 E N
6 F O
7 G P
8 H Q
9 I R

Thanks,

Bram.

Ron Rosenfeld wrote:
My cells in a column are filled with amounts for
which I have to change the last digit into a letter.

[quoted text clipped - 13 lines]
Is there any other way you can think of?
Thanks.


You're description is inconsistent since it seems as if you want to convert
digits 0-9, yet if you have 1 = A or J depending on positive or negative, it's
not clear what you want to do if the last digit is zero.

So I changed your specifications so that 0 -- A or K; 1 -- B or L; etc.

You can do that with the formula:

=LEFT(A1,LEN(A1)-1)&CHAR(RIGHT(A1,1)+65+10*(A1<0))

--ron



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200510/1


  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

I'd create another worksheet (I used sheet2) and put that table in columns A:C.

Then with the value to convert in A1 (of the first sheet):

=LEFT(A1,LEN(A1)-1)&VLOOKUP(--RIGHT(A1),Sheet2!A:C,IF(A1=0,2,3),FALSE)



"bramruis via OfficeKB.com" wrote:

Yes, sorry. You're right.
Here are the values that I need:

Last digit: Positive value: Negative value:

0 { }
1 A J
2 B K
3 C L
4 D M
5 E N
6 F O
7 G P
8 H Q
9 I R

Thanks,

Bram.

Ron Rosenfeld wrote:
My cells in a column are filled with amounts for
which I have to change the last digit into a letter.

[quoted text clipped - 13 lines]
Is there any other way you can think of?
Thanks.


You're description is inconsistent since it seems as if you want to convert
digits 0-9, yet if you have 1 = A or J depending on positive or negative, it's
not clear what you want to do if the last digit is zero.

So I changed your specifications so that 0 -- A or K; 1 -- B or L; etc.

You can do that with the formula:

=LEFT(A1,LEN(A1)-1)&CHAR(RIGHT(A1,1)+65+10*(A1<0))

--ron


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200510/1


--

Dave Peterson
  #7   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

On Thu, 27 Oct 2005 13:14:07 GMT, "bramruis via OfficeKB.com" <u15176@uwe
wrote:

Yes, sorry. You're right.
Here are the values that I need:

Last digit: Positive value: Negative value:

0 { }
1 A J
2 B K
3 C L
4 D M
5 E N
6 F O
7 G P
8 H Q
9 I R

Thanks,

Bram.

Ron Rosenfeld wrote:
My cells in a column are filled with amounts for
which I have to change the last digit into a letter.

[quoted text clipped - 13 lines]
Is there any other way you can think of?
Thanks.


You're description is inconsistent since it seems as if you want to convert
digits 0-9, yet if you have 1 = A or J depending on positive or negative, it's
not clear what you want to do if the last digit is zero.

So I changed your specifications so that 0 -- A or K; 1 -- B or L; etc.

You can do that with the formula:

=LEFT(A1,LEN(A1)-1)&CHAR(RIGHT(A1,1)+65+10*(A1<0))

--ron


Well, have to make zero a special case, then.

You can use this formula:

=LEFT(A1,LEN(A1)-1)&IF(MOD(A1,10)<0,CHAR(
RIGHT(A1,1)+64+9*(A1<0)),CHAR(123+2*(A1<0)))


--ron
  #8   Report Post  
bramruis via OfficeKB.com
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

Thanks Dave and Ron.
Your formulas both work great!!

Bram.

Ron Rosenfeld wrote:
Yes, sorry. You're right.
Here are the values that I need:

[quoted text clipped - 33 lines]

--ron


Well, have to make zero a special case, then.

You can use this formula:

=LEFT(A1,LEN(A1)-1)&IF(MOD(A1,10)<0,CHAR(
RIGHT(A1,1)+64+9*(A1<0)),CHAR(123+2*(A1<0)))

--ron



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200511/1
  #9   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default How to replace the last digit in a cell with a letter

On Wed, 02 Nov 2005 08:43:35 GMT, "bramruis via OfficeKB.com" <u15176@uwe
wrote:

Thanks Dave and Ron.
Your formulas both work great!!

Bram.


You're welcome. Thanks for the feedback.


--ron
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
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Replace null string with blank cell gjcase Excel Discussion (Misc queries) 2 August 9th 05 02:13 PM
Replace part of link address in a cell with a value(date) from ano Hakan Excel Discussion (Misc queries) 0 July 20th 05 12:39 PM
Append Text to Cell Values Using Replace Ngan Excel Discussion (Misc queries) 4 June 4th 05 08:30 PM
How do I add row total when cell contains both number and letter . cbarcroft Excel Discussion (Misc queries) 4 April 18th 05 11:52 PM


All times are GMT +1. The time now is 08:07 AM.

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"