Removing the Last Two...

tourless

Board Regular
Joined
Feb 8, 2007
Messages
140
Office Version
  1. 365
Platform
  1. Windows
Hi Folks,

I know this has been asked a thousand times and I'm trying to implement some of the solutions I've found but I just can't seem to get this to work. I have values in column I that four decimal places deep and I simply want to remove the last two characters. The problem I'm noticing is some of the values only contain two digits even though the cells are formatted to four decimal places. So a value of 56.34 is formatted as 56.3400. Other cells have actual values that are three of four decimal places deep, such as a value of 5.7324 is formatted as 5.7324, and a value of 4.242 is formatted as 4.2420. So I guess I need to evaluate each cell in my range and add a few if's to account for the variations? This is what I'm working with.

VBA Code:
For i = 2 To LastRow
    .Cells(i, "I") = Left(.Cells(i, "I").Value, Len(.Cells(i, "I").Value) - 2)
Next i
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Don't get me wrong, it does exactly what I asked for, but my complete solution involves many steps. The way I build my solutions is to tackle one problem at a time in order. So like I said this brings me a lot closer to my goal.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,202
Members
448,554
Latest member
Gleisner2

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