Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Location: Birmingham
Posts: 5
Question Replacing formula with round multiple times

Hi all

I have a spreadsheet that has around 12000 lines, in column D there is a formula that creates a value such as 2000.123524. The value needs to be exported to another application but I have to remove the decimal places first.

How can I encase the current formula with the round function for all the lines in one go? It would be a real chore to edit every line. I can't change the top formula and copy it down as all the formula source data comes from different places.

I know you can use replace but as I need to replace more than one thing in the current formula I can't see that it is possible

Before example
=(A1/A2)
I need
=round(A1/A2,0)

Thanks all
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Replacing formula with round multiple times

Sub RoundAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=ROUND(*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=ROUND(" & myStr & ",0)"
End If
End If
Next
End Sub

Select column D then run the macro.


Gord Dibben MS Excel MVP

On Thu, 17 Jan 2008 17:09:31 +0000, andyhofer
wrote:


Hi all

I have a spreadsheet that has around 12000 lines, in column D there is
a formula that creates a value such as 2000.123524. The value needs to
be exported to another application but I have to remove the decimal
places first.

How can I encase the current formula with the round function for all
the lines in one go? It would be a real chore to edit every line. I
can't change the top formula and copy it down as all the formula source
data comes from different places.

I know you can use replace but as I need to replace more than one thing
in the current formula I can't see that it is possible

Before example
=(A1/A2)
I need
=round(A1/A2,0)

Thanks all


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I round off times in Excel? Andrew Excel Worksheet Functions 5 July 18th 06 10:47 PM
Help needed replacing multiple cells from a list of values. Emoshag Excel Discussion (Misc queries) 6 July 6th 06 09:15 PM
Replacing sheet reference in multiple cells... neilcarden Excel Worksheet Functions 3 June 23rd 06 05:00 PM
multiple and round Heather Gilroy Excel Worksheet Functions 2 July 22nd 05 06:38 PM
INTRICATE PROBLEM- How to find multiple text,excluding "H", in a multiple range of cells, then replacing 0 with another number in another cell Tourcat Excel Worksheet Functions 1 February 8th 05 06:26 PM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"