Add decimals and rounding

ExcelMK

New Member
Joined
Apr 26, 2017
Messages
2
I have a data file of X/Y coordinates that I need to edit.

The data needs to end up in the following format:

X10345Y06523
X03476Y12279

There is an implied decimal after the second digit, so the numeric values of the above are:

X10.345Y06.523
X03.476Y12.279

In the final data, it does not matter if the decimal is present or not as long as there are 5 digits in the final number. Leading and trailing zeroes can not be removed.

The data that I have been supplied is in the following format:

X076299Y101900
X067450Y102083

which is the equivalent of

X07.6299Y10.1900
X06.7450Y10.2083

I need to round the data so that it is back to only 5 digits (3 places after the decimal).

The result I would want for the above numbers is:

X07.630Y10.190
X06.745Y10.208

or without the decimal point

X07630Y10190
X06745Y10208

I need the numbers rounded up or down as appropriate to the nearest thousandth and I need to keep leading and trailing zeroes to retain the 5 digit format.

Currently, I have the X and Y coordinates split into individual columns in Excel. I've managed to get the leading zeroes to stay by specifying a custom type with the format "000000". I have tried a few things with the ROUND function, but it is not giving me the results that I want.

Any help would be greatly appreciated.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi, welcome to the forum! Here's some options you could consider.


Excel 2013
ABCDE
1X076299Y101900X07.630Y10.190X07.630Y10.190X07630Y10190
2X067450Y102083X06.745Y10.208X06.745Y10.208X06745Y10208
Sheet1
Cell Formulas
RangeFormula
B1=TEXT(ROUND(TEXT(MID(A1,2,6),"00\.0000"),3),"\X00.000")
C1=TEXT(ROUND(TEXT(RIGHT(A1,6),"00\.0000"),3),"\Y00.000")
D1=B1&C1
E1=SUBSTITUTE(D1,".","")
 
Upvote 0
Worksheet Formulas
CellFormula
B1=TEXT(ROUND(TEXT(MID(A1,2,6),"00\.0000"),3),"\X00.000")
C1=TEXT(ROUND(TEXT(RIGHT(A1,6),"00\.0000"),3),"\Y00.000")
D1=B1&C1
E1=SUBSTITUTE(D1,".","")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
Why not just these for the first two formula...

B1: =TEXT(MID(A1,2,6)/10000,"\X00.000")

C1: =TEXT(RIGHT(A1,6)/10000,"\Y00.000")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,398
Members
449,222
Latest member
taner zz

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