ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Calculation (https://www.excelbanter.com/new-users-excel/144973-calculation.html)

dk

Calculation
 
Is there anyway to have in the same cell 10% increase
ex; we shall input data $75.00 and this shall be changed automatcally to
$82.50 without having to have 2 cells or columns please explain

JE McGimpsey

Calculation
 
You can do this with an event macro.

For instance, put this in your worksheet code module (right-click the
worksheet tab and choose View Code):


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const csSCALEFACTOR As Double = 1.1 'Add 10%
With Target
If .Count 1 Then Exit Sub
If Not Intersect(.Cells, Range("A1,C1")) Is Nothing Then
If IsNumeric(.Value) Then
On Error Resume Next
Application.EnableEvents = False
.Value = Application.Round(.Value * csSCALEFACTOR, 2)
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End With
End Sub

If you're not familiar with macros, see

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In article ,
dk wrote:

Is there anyway to have in the same cell 10% increase
ex; we shall input data $75.00 and this shall be changed automatcally to
$82.50 without having to have 2 cells or columns please explain


Stan Brown

Calculation
 
Sun, 3 Jun 2007 08:33:02 -0700 from dk
:
Is there anyway to have in the same cell 10% increase
ex; we shall input data $75.00 and this shall be changed automatcally to
$82.50 without having to have 2 cells or columns please explain


You're trying to do something that is not really how Excel was
intended to work. You can force Excel to do it, but you'll save a lot
of effort if you work with Excel as it was intended:

cell A1 contains value
cell B1 contains =round(A1*1.10,2)

or else choose a product that more nearly meets your requirements.

If you really need to do that thing, and it really has to be in
Excel, then a macro is the only way I know of.


--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/


All times are GMT +1. The time now is 06:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com