Adding a period to records in columns

aberfroman

Board Regular
Joined
Dec 11, 2009
Messages
77
Thanks for help in advance, I have a sheet with data in a column that have letters and numbers (example. HGSJD423). I want to be able to change this description to HGSJD4.023. I have about 2,000 recordes, which are all different descriptions, but want to add ".0" in between the description. Thanks.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Thanks for help in advance, I have a sheet with data in a column that have letters and numbers (example. HGSJD423). I want to be able to change this description to HGSJD4.023. I have about 2,000 recordes, which are all different descriptions, but want to add ".0" in between the description. Thanks.

This assumes the "descriptions" are all eight characters long.
=LEFT(A1,6) & ".0" & RIGHT(A1,2)
 
Upvote 0
Thanks for help in advance, I have a sheet with data in a column that have letters and numbers (example. HGSJD423). I want to be able to change this description to HGSJD4.023. I have about 2,000 recordes, which are all different descriptions, but want to add ".0" in between the description. Thanks.
Assuming the ".0" will always be placed so that the rightmost three digits will always be located after it, and assuming you want to change the values directly within their cells, give this macro a try (select the column you want to change and then run it)...

Code:
Sub InsertPeriod()
  Dim Addr
  Addr = Intersect(Selection, ActiveSheet.UsedRange).Address
  Range(Addr) = Evaluate(Replace("IF(@="""","""",replace(@,len(@)-1,0,"".0""))", "@", Addr))
End Sub

Alternately, if you are looking for a formula to display the changed values in another column, you can use this formula...

=REPLACE(A1,LEN(A1)-1,0,".0")



HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (InsertPeriod) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook. If you will not need to execute this macro again, just save the workbook as a normal (.xlsx) file and the macro will be stripped away at that time (answer "Yes" to the warning that a VB Project cannot be saved in a macro-free workbook).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

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