PC Review


Reply
Thread Tools Rate Thread

Add ROUND function to formulas

 
 
Steph
Guest
Posts: n/a
 
      26th Sep 2008
I have a large data set that includes text, constants, and formulas. I would
like to add the ROUND function to each cell where a formula occurs (i.e.
round the value returned from each formula to zero decimal points). Can
anyone suggest a macro to do so?

Thank you.

--
Steph
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      26th Sep 2008
Something like this should be close...

Sub AddRoundFunction()
Dim rngFormulas As Range
Dim rng As Range

On Error Resume Next
Set rngFormulas = UsedRange.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0

If Not rngFormulas Is Nothing Then
For Each rng In rngFormulas
rng.Formula = "=round(" & Mid(rng.Formula, 2, 1024) & ", 0)"
Next rng
End If
End Sub
--
HTH...

Jim Thomlinson


"Steph" wrote:

> I have a large data set that includes text, constants, and formulas. I would
> like to add the ROUND function to each cell where a formula occurs (i.e.
> round the value returned from each formula to zero decimal points). Can
> anyone suggest a macro to do so?
>
> Thank you.
>
> --
> Steph

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      26th Sep 2008
Do you mean you want a macro that will be run one time and which will
permanently change your formulas so that they include the ROUND function
afterwards? If so, do **ALL** your formulas return numeric values (or do you
have some that perhaps return dates, text, etc.)? If not, are the formulas
that do return values confined to the same column or columns so they can be
selected or their range(s) specified?

--
Rick (MVP - Excel)


"Steph" <(E-Mail Removed)> wrote in message
news:5158921C-8EC9-4FE3-8235-(E-Mail Removed)...
>I have a large data set that includes text, constants, and formulas. I
>would
> like to add the ROUND function to each cell where a formula occurs (i.e.
> round the value returned from each formula to zero decimal points). Can
> anyone suggest a macro to do so?
>
> Thank you.
>
> --
> Steph


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Function Round vs Excel function Round not behaving the same Od =?Utf-8?B?QnVk?= Microsoft Excel Programming 5 18th Aug 2006 05:39 AM
Round formulas =?Utf-8?B?bXN0YWNr?= Microsoft Excel Worksheet Functions 4 3rd Jul 2006 05:40 PM
How do I round up or down using formulas? =?Utf-8?B?UHJpY2luZyBRdWVlbg==?= Microsoft Excel Worksheet Functions 2 29th Nov 2004 06:15 PM
Re: @ Round Formulas J.E. McGimpsey Microsoft Excel Programming 0 28th Oct 2003 07:02 PM
Re: @ Round Formulas steve Microsoft Excel Programming 0 28th Oct 2003 06:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:35 AM.