Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pieman
 
Posts: n/a
Default Connected calculation of three cells

Hi

I have three cells in a single worksheet that represent a weekly, monthly
and annual sales target. Does anyone know the formula to ensure that if a
target is eneterd in any of three cells, the other two are automatically
calculated.

For example, if I enter a weekly target, the monthly target is calculated by
multiplying the weekly figure entered by 52 and dividing by 12. This should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered in any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer
 
Posts: n/a
Default Connected calculation of three cells

If you want to allow any one of the cells to be entered and the other two
calculated, I think doing this entirely with formulas would require circular
references. I'd either use VBA to detect the data entry (the
worksheet_change event) and fill in the other two cells or separate the input
cells from the three different output cells.
If you choose the latter approach, I'd probably provide two input cells, one
for the target and the other a dropdown (using data validation) to select
'Per Week', 'Per Month' or 'Per Year'. Then I'd calculate the annual target
based on those two cells, and the weekly and monthly goals by multiplying the
annual target by 1/52 and 1/12, respectively.

"Pieman" wrote:

Hi

I have three cells in a single worksheet that represent a weekly, monthly
and annual sales target. Does anyone know the formula to ensure that if a
target is eneterd in any of three cells, the other two are automatically
calculated.

For example, if I enter a weekly target, the monthly target is calculated by
multiplying the weekly figure entered by 52 and dividing by 12. This should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered in any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ardus Petus
 
Posts: n/a
Default Connected calculation of three cells

Assuming your data (Week/Month/Year) are in cells B1 to B3,
enter following sub in your worksheet's code:

'---------------------------------------------------------------------------
---
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B3")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .Value = "" Then
Range("B1:B3").Value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("B2").Value = .Value * 52 / 12
Range("B3").Value = .Value * 52
Case 2 'Monthly
Range("B1").Value = .Value * 12 / 52
Range("B3").Value = .Value * 12
Case 3 'Yearly
Range("B1").Value = .Value / 12
Range("B2").Value = .Value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub

'---------------------------------------------------------------------------
---
HTH
--
AP

"Pieman" a écrit dans le message de
...
Hi

I have three cells in a single worksheet that represent a weekly, monthly
and annual sales target. Does anyone know the formula to ensure that if a
target is eneterd in any of three cells, the other two are automatically
calculated.

For example, if I enter a weekly target, the monthly target is calculated

by
multiplying the weekly figure entered by 52 and dividing by 12. This

should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered in any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pieman
 
Posts: n/a
Default Connected calculation of three cells

Ardus

Thanks for your response. The three cells are E4:E6 on worksheet 'Adviser
Stats'. I have inserted the following code in the VB editor but the
calculations don't work:

------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E4:E6")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .value = "" Then
Range("E4:E6").value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("E5").value = .value * 52 / 12
Range("E6").value = .value * 52
Case 2 'Monthly
Range("E4").value = .value * 12 / 52
Range("E6").value = .value * 12
Case 3 'Yearly
Range("E4").value = .value / 12
Range("E5").value = .value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub
-----------------------------------------------------

Any ideas what I'm doing wrong?

Thanks
Simon

"Ardus Petus" wrote:

Assuming your data (Week/Month/Year) are in cells B1 to B3,
enter following sub in your worksheet's code:

'---------------------------------------------------------------------------
---
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B3")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .Value = "" Then
Range("B1:B3").Value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("B2").Value = .Value * 52 / 12
Range("B3").Value = .Value * 52
Case 2 'Monthly
Range("B1").Value = .Value * 12 / 52
Range("B3").Value = .Value * 12
Case 3 'Yearly
Range("B1").Value = .Value / 12
Range("B2").Value = .Value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub

'---------------------------------------------------------------------------
---
HTH
--
AP

"Pieman" a écrit dans le message de
...
Hi

I have three cells in a single worksheet that represent a weekly, monthly
and annual sales target. Does anyone know the formula to ensure that if a
target is eneterd in any of three cells, the other two are automatically
calculated.

For example, if I enter a weekly target, the monthly target is calculated

by
multiplying the weekly figure entered by 52 and dividing by 12. This

should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered in any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett
 
Posts: n/a
Default Connected calculation of three cells

In THIS PARTICULAR case you would need to change case to 4,5,6 instead of
1,2,3

--
Don Guillett
SalesAid Software

"Pieman" wrote in message
...
Ardus

Thanks for your response. The three cells are E4:E6 on worksheet 'Adviser
Stats'. I have inserted the following code in the VB editor but the
calculations don't work:

------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E4:E6")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .value = "" Then
Range("E4:E6").value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("E5").value = .value * 52 / 12
Range("E6").value = .value * 52
Case 2 'Monthly
Range("E4").value = .value * 12 / 52
Range("E6").value = .value * 12
Case 3 'Yearly
Range("E4").value = .value / 12
Range("E5").value = .value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub
-----------------------------------------------------

Any ideas what I'm doing wrong?

Thanks
Simon

"Ardus Petus" wrote:

Assuming your data (Week/Month/Year) are in cells B1 to B3,
enter following sub in your worksheet's code:

'---------------------------------------------------------------------------
---
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B3")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .Value = "" Then
Range("B1:B3").Value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("B2").Value = .Value * 52 / 12
Range("B3").Value = .Value * 52
Case 2 'Monthly
Range("B1").Value = .Value * 12 / 52
Range("B3").Value = .Value * 12
Case 3 'Yearly
Range("B1").Value = .Value / 12
Range("B2").Value = .Value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub

'---------------------------------------------------------------------------
---
HTH
--
AP

"Pieman" a écrit dans le message de
...
Hi

I have three cells in a single worksheet that represent a weekly,
monthly
and annual sales target. Does anyone know the formula to ensure that if
a
target is eneterd in any of three cells, the other two are
automatically
calculated.

For example, if I enter a weekly target, the monthly target is
calculated

by
multiplying the weekly figure entered by 52 and dividing by 12. This

should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered in
any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon






  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pieman
 
Posts: n/a
Default Connected calculation of three cells

Great, thank you, that works perfect.

"Don Guillett" wrote:

In THIS PARTICULAR case you would need to change case to 4,5,6 instead of
1,2,3

--
Don Guillett
SalesAid Software

"Pieman" wrote in message
...
Ardus

Thanks for your response. The three cells are E4:E6 on worksheet 'Adviser
Stats'. I have inserted the following code in the VB editor but the
calculations don't work:

------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E4:E6")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .value = "" Then
Range("E4:E6").value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("E5").value = .value * 52 / 12
Range("E6").value = .value * 52
Case 2 'Monthly
Range("E4").value = .value * 12 / 52
Range("E6").value = .value * 12
Case 3 'Yearly
Range("E4").value = .value / 12
Range("E5").value = .value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub
-----------------------------------------------------

Any ideas what I'm doing wrong?

Thanks
Simon

"Ardus Petus" wrote:

Assuming your data (Week/Month/Year) are in cells B1 to B3,
enter following sub in your worksheet's code:

'---------------------------------------------------------------------------
---
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B3")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .Value = "" Then
Range("B1:B3").Value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("B2").Value = .Value * 52 / 12
Range("B3").Value = .Value * 52
Case 2 'Monthly
Range("B1").Value = .Value * 12 / 52
Range("B3").Value = .Value * 12
Case 3 'Yearly
Range("B1").Value = .Value / 12
Range("B2").Value = .Value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub

'---------------------------------------------------------------------------
---
HTH
--
AP

"Pieman" a écrit dans le message de
...
Hi

I have three cells in a single worksheet that represent a weekly,
monthly
and annual sales target. Does anyone know the formula to ensure that if
a
target is eneterd in any of three cells, the other two are
automatically
calculated.

For example, if I enter a weekly target, the monthly target is
calculated
by
multiplying the weekly figure entered by 52 and dividing by 12. This
should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered in
any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon






  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ardus Petus
 
Posts: n/a
Default Connected calculation of three cells

You only have to change the constants
HTH
--
AP

'-------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Const addrWeek As String = "$E$4"
Const addrMonth As String = "$E$5"
Const addrYear As String = "$E$6"
Dim WMY As Range
Set WMY = Range( _
addrWeek & "," & _
addrMonth & "," & _
addrYear)
If Intersect(Target, WMY) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .Value = "" Then
WMY.Value = ""
Else
Select Case Target.Address
Case addrWeek 'Weekly
Range(addrMonth).Value = .Value * 52 / 12
Range(addrYear).Value = .Value * 52
Case addrMonth 'Monthly
Range(addrWeek).Value = .Value * 12 / 52
Range(addrYear).Value = .Value * 12
Case addrYear 'Yearly
Range(addrWeek).Value = .Value / 12
Range(addrMonth).Value = .Value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub
'---------------------------------------


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett
 
Posts: n/a
Default Connected calculation of three cells

glad to help. This could be re-written to be more flexible for other
situations.

--
Don Guillett
SalesAid Software

"Pieman" wrote in message
...
Great, thank you, that works perfect.

"Don Guillett" wrote:

In THIS PARTICULAR case you would need to change case to 4,5,6 instead of
1,2,3

--
Don Guillett
SalesAid Software

"Pieman" wrote in message
...
Ardus

Thanks for your response. The three cells are E4:E6 on worksheet
'Adviser
Stats'. I have inserted the following code in the VB editor but the
calculations don't work:

------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E4:E6")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .value = "" Then
Range("E4:E6").value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("E5").value = .value * 52 / 12
Range("E6").value = .value * 52
Case 2 'Monthly
Range("E4").value = .value * 12 / 52
Range("E6").value = .value * 12
Case 3 'Yearly
Range("E4").value = .value / 12
Range("E5").value = .value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub
-----------------------------------------------------

Any ideas what I'm doing wrong?

Thanks
Simon

"Ardus Petus" wrote:

Assuming your data (Week/Month/Year) are in cells B1 to B3,
enter following sub in your worksheet's code:

'---------------------------------------------------------------------------
---
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B3")) Is Nothing _
Or Target.Count < 1 _
Then Exit Sub
Application.EnableEvents = False
With Target
If .Value = "" Then
Range("B1:B3").Value = ""
Else
Select Case Target.Row
Case 1 'Weekly
Range("B2").Value = .Value * 52 / 12
Range("B3").Value = .Value * 52
Case 2 'Monthly
Range("B1").Value = .Value * 12 / 52
Range("B3").Value = .Value * 12
Case 3 'Yearly
Range("B1").Value = .Value / 12
Range("B2").Value = .Value / 52
End Select
End If
End With
Application.EnableEvents = True
End Sub

'---------------------------------------------------------------------------
---
HTH
--
AP

"Pieman" a écrit dans le message de
...
Hi

I have three cells in a single worksheet that represent a weekly,
monthly
and annual sales target. Does anyone know the formula to ensure that
if
a
target is eneterd in any of three cells, the other two are
automatically
calculated.

For example, if I enter a weekly target, the monthly target is
calculated
by
multiplying the weekly figure entered by 52 and dividing by 12. This
should
also calculate the annual figure in the third cell.

The part I can't work out is how to allow the target to be entered
in
any
three cells and the other two be automatically calculated.

Any ideas would be greatly appreciated.

Thanks
Simon








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
Calculation of instances a value is found in a series of cells DSBTX Excel Worksheet Functions 0 February 24th 06 06:57 AM
Setting Manual Calculation on Specific Cells Only Jim Hagan Excel Discussion (Misc queries) 3 February 23rd 06 08:09 PM
Display first, second, etc Nonblank Cells in a Range Jeremy N. Excel Worksheet Functions 12 September 25th 05 01:47 PM
Use functions when cells are merged Amanda Excel Worksheet Functions 3 September 12th 05 06:08 PM
Help adding text values Texas-DC_271 Excel Worksheet Functions 7 January 15th 05 11:14 PM


All times are GMT +1. The time now is 09:24 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"