I have numbers with a letter at the end. I would like to change that letter to a number.

MikeBor

New Member
Joined
Dec 30, 2022
Messages
7
Office Version
  1. 2010
Platform
  1. Windows
I have daily downloads of a file that place a "K" or an "M" at the end of a number to represent "thousand" or "million". I would like to change the "K" and "M" to numbers. The "K" would add "one zero" to the end of the number and the "M" would add 4 zero's to the end of the number. Example shown below...

Thank You

2022-12-30_7-55-23.png
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I still think this is much more efficient.
It doesn't return the correct values.
Compare your formula to the other one, and you will see the difference.
All your formula does is remove the "M" or "K", it doesn't change/increase the value at all.
 
Upvote 0
Thank You So Much!! You were very close....but I saw what I could do to get the correct formula....This is what worked.....I just had to add a couple of zero's...

=IF(RIGHT(A1,1)="K",SUBSTITUTE(A1,"K","")*1000,IF(RIGHT(A1,1)="M",SUBSTITUTE(A1,"M","")*10000,A1))
You are welcome.
Sorry, I confused some of the replies, and picked up the multipliers of 10 and 10000 from the other post.
 
Upvote 0
Then it would be:
Excel Formula:
=SUBSTITUTE(SUBSTITUTE(A1, "K", "000"), "M", "000000")+0
 
Upvote 0
I still think this is much more efficient.
Flashbond, I appreciate your help for sure......this screenshot may help show the differences.....
Column A = The Original Number
Column B = Your formula....but it does not allow me to add a comma and it does not convert the "millions" into 7 digit numbers and the "thousands" into 4 digit numbers.
Column C = What I was looking for so that I could add series of numbers.

My explanation of what I needed may not have been the best representation of what I was looking to do. If that was the case....Sorry for that and thanks for all of your help.

2022-12-30_8-43-08.png
 
Upvote 0
Then it would be:
Excel Formula:
=SUBSTITUTE(SUBSTITUTE(A1, "K", "000"), "M", "000000")+0
Still doesn't work. Have you actually tried them and compared the results?

1672408191939.png


The only way I can think of you where yours would work if the periods were treated as thousands separators and not decimal points.
 
Upvote 0
If your samples are representative and every value has 2 decimal places and ends with K or M, then wouldn't this suffice?

Excel Formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,".",""),"K",0),"M","0000")+0
 
Upvote 0
B1: =VALUE(SUBSTITUTE(IFERROR(IF(SEARCH("K",A1),SUBSTITUTE(A1,"K",0)),SUBSTITUTE(A1,"M","0000")),".",""))
 

Attachments

  • 1672571170026.png
    1672571170026.png
    19.8 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,214,959
Messages
6,122,476
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top