VBA: Make Copies based on the number with largest decimal no.s.

panyagak

Board Regular
Joined
Feb 24, 2017
Messages
236
Hi Mrexcel Experts

Am wondering how to go about this last problem, the VBA WAY, currently facing me in my Numerical Analysis.

My data starts on Cell A2 and ends on Cell U..eg. A2:U11200, A2:U17000 etc.
Row 1 is Header.

In my bid to further ensure "exactitude" of data due to "round-off errors", I need to use up ALL digits after 2 d.p to the last d.p excluding the last zeroes.

NOTE: HAVE STANDARDISED ALL NO.S TO 1., 2., 3., ETC FOR SIMPLICITY.

First, the code to identify the value within the row (from Columns N,P,R,S,T,U) with the longest digits & count the digits AFTER THE 2 d.p. UP TO THE START OF UNENDING ZEROES (Eg. - 1.18338760000 - If 5, THEN make 5 row copies downwards - to ensure 3 to 5 d.ps are all captured AS IN 1.18, 1.183, 1.1833, 1.18339, 1.183388 & 1.1833876.
IGNORE DUPLICATES & ZEROES FOR THE OTHER NUMBERS!

The first copy begins with 2 decimal places rounded-off, then 3,4,5 to last d.p.

Eg. 1 Columns N,P,R,S,T,U
9 Extra Copies needed downwards. (Based on Col. R)
N. 1.18338760000
P. 3.867670000
R. 1.516447368420000
S. 5.33356560000
T. 1.58675680000
U. 2.1033780000

Eg. 2 Columns N,P,R,S,T,U
12 Extra Copies needed downwards. (Based on Col. U)
N. 1.183340000
P. 3.867560000
R. 2.1033550000
S. 5.33397660000
T. 1.58675780000
U. 1.454545454545450000

Kindly help out. (ALTERNATIVE APPROACHES ARE WELCOME).
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Watch MrExcel Video

Forum statistics

Threads
1,101,914
Messages
5,483,686
Members
407,399
Latest member
Rakeforms

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top