Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,560
Default excel formula - possibly visual basic method

I need to set up a quite a complicated spread sheet. This is the senario: say
my sales figure for monday is £50 (which is my target). However my actual
sales figure for monday is £40. How do i get the cell to show the difference
between my forecast(target) and my actual having predefined the cell with my
target sales figure so that when i type the actual sales figure in it will
automatically show the difference(+/-). How do i predefine the cell with the
forecast sales figure for a cell?

In addition to this i would like to know how if i hit the sales target do i
get the cell to show green. And if the sales target is missed how do i get
the cell to show red without having to change the cell each time.

What hopefully should happen is that as in the above scenario if for the
monday i typed in the actual sales figure as £40, the cell will hopefully
show -£10 with the cell baground turning red. If for example i typed in £60
for monday it would show +£10 and the cell would turn green. I hope to repeat
this process for the rest of the week with different forecast figures! Many
thanks




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,047
Default excel formula - possibly visual basic method

hi David,

assuming that you have the actual figures on the B column, the forecast
figures on the C column and the variance on the D column. you can hide the
forecast column if it's necessary for your proposal.

on D column use the formula
=b2-c2

and use a conditional format to set the cell red or green:
click on format menu chose conditional format, on the drop down chose bigger
than - on the box type 0 format as you need color, font color, borders
add an new condition chose lower than - on the box type 0


hth
--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"David" escreveu:

I need to set up a quite a complicated spread sheet. This is the senario: say
my sales figure for monday is £50 (which is my target). However my actual
sales figure for monday is £40. How do i get the cell to show the difference
between my forecast(target) and my actual having predefined the cell with my
target sales figure so that when i type the actual sales figure in it will
automatically show the difference(+/-). How do i predefine the cell with the
forecast sales figure for a cell?

In addition to this i would like to know how if i hit the sales target do i
get the cell to show green. And if the sales target is missed how do i get
the cell to show red without having to change the cell each time.

What hopefully should happen is that as in the above scenario if for the
monday i typed in the actual sales figure as £40, the cell will hopefully
show -£10 with the cell baground turning red. If for example i typed in £60
for monday it would show +£10 and the cell would turn green. I hope to repeat
this process for the rest of the week with different forecast figures! Many
thanks




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default excel formula - possibly visual basic method

David

Without VBA you can have a value or a formula in a cell, not both at the same
time.

I would stick my target number in a cell, say E1

In A1 I would enter the Monday sales figure of 40

In B1 I would enter =A1-E1

Select B1 and FormatConditional FormattingCondition1Formula is =B1<E1
format to red

AddCondition2Formula is =B1=E1 format to green.

These formats can be copied to other cells by using the formatting paintbrush.

If you wnat to do it all in one cell event code is your friend.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
n = Target.Row
If Excel.Range("B" & n).Value < "" Then
Excel.Range("B" & n).Value = Excel.Range("B" & n).Value _
- Excel.Range("E1")
End If
End If
enditall:
Application.EnableEvents = True
End Sub

E1 contains your daily target.

Column B is where you enter the daily sales figures.

Also place the CF on column B cells.


Gord Dibben MS Excel MVP


On Thu, 21 Sep 2006 13:04:02 -0700, David
wrote:

I need to set up a quite a complicated spread sheet. This is the senario: say
my sales figure for monday is £50 (which is my target). However my actual
sales figure for monday is £40. How do i get the cell to show the difference
between my forecast(target) and my actual having predefined the cell with my
target sales figure so that when i type the actual sales figure in it will
automatically show the difference(+/-). How do i predefine the cell with the
forecast sales figure for a cell?

In addition to this i would like to know how if i hit the sales target do i
get the cell to show green. And if the sales target is missed how do i get
the cell to show red without having to change the cell each time.

What hopefully should happen is that as in the above scenario if for the
monday i typed in the actual sales figure as £40, the cell will hopefully
show -£10 with the cell baground turning red. If for example i typed in £60
for monday it would show +£10 and the cell would turn green. I hope to repeat
this process for the rest of the week with different forecast figures! Many
thanks




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
Convert Excel 4 formula to Excel 2003 format The Gasell Excel Worksheet Functions 3 April 12th 06 05:07 PM
Excel 97 formula doesn't work in Excel 2003 [email protected] Excel Discussion (Misc queries) 2 April 4th 06 09:34 PM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Visual Basic I/O error when opening Excel file SK Low Excel Worksheet Functions 0 November 24th 05 09:52 AM
Excel formula similar to a loop in Basic? Cashtime Excel Worksheet Functions 2 February 6th 05 07:53 PM


All times are GMT +1. The time now is 08:15 PM.

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

About Us

"It's about Microsoft Excel"