Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
cwal
 
Posts: n/a
Default increasing and decreasing a value in a cell


Hi there, first time user here.

I am looking for some help with a personal worksheet I am creating to
control stock of medication by usage. What I need help on is that I
have an initial value in a cell (stock level) and I need to add to it
the value of another cell (supply) in such a way that stock level now
reflects the new value and increases as a new value is entered in the
supply field and decreases based on a value (daily usage) in another
cell. The spreadsheet has to hold the new stock level as the current
value each time the document is opened and amended.

ie:
B3 (stock level) initial value is 20.
B4 (supply) is 4 -value added to B3-
B3 (stock level) value now 24
B5 (daily usage) -3 -value deducted from B3-
B3 (stock level) now 21
B4 (supply) changed to 6 -value added to B3-
B3 (stock level) now 29


I don't know enough about advanced formulas or scripting to get the
worksheet to do what I need it to do. It has to be able to run in excel
as I need to carry the worksheet around in a PDA.

If anyone can decipher what I am looking for and can advise a solution
it would be VERY appreciated.


--
cwal
------------------------------------------------------------------------
cwal's Profile: http://www.excelforum.com/member.php...o&userid=33493
View this thread: http://www.excelforum.com/showthread...hreadid=532926

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carim
 
Posts: n/a
Default increasing and decreasing a value in a cell

Hi,

There is something I do not understand ...
the final value is either 23 or 27 ...
If it is 29 ... can you explain how ?

Carim

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
cwal
 
Posts: n/a
Default increasing and decreasing a value in a cell


Carim Wrote:
Hi,

There is something I do not understand ...
the final value is either 23 or 27 ...
If it is 29 ... can you explain how ?

Carim


Oh dear! my very first post and I can't even add 6 to 21...

Yes. 27 would be the final result in this example.
(covers head in shame).


--
cwal
------------------------------------------------------------------------
cwal's Profile: http://www.excelforum.com/member.php...o&userid=33493
View this thread: http://www.excelforum.com/showthread...hreadid=532926

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carim
 
Posts: n/a
Default increasing and decreasing a value in a cell


The question is whether you can input your values in distinct cells, or
if, for some reason, there is a substitution taking place ...in your
example is 6 replacing 4 or is 6 added to another cell ... ?
As you can imagine, the solution will not be the same ...

Carim


--
Carim
------------------------------------------------------------------------
Carim's Profile: http://www.excelforum.com/member.php...o&userid=33259
View this thread: http://www.excelforum.com/showthread...hreadid=532926

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
cwal
 
Posts: n/a
Default increasing and decreasing a value in a cell


For what I want, 6 will replace 4.

This cell will be where I enter how much we bought of a specific item.
It will then be added to the current stock level.

The other cell being used will be how much we used of the specific item
and will be deducted from the current stock level.

The third cell being the stock level.


--
cwal
------------------------------------------------------------------------
cwal's Profile: http://www.excelforum.com/member.php...o&userid=33493
View this thread: http://www.excelforum.com/showthread...hreadid=532926



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carim
 
Posts: n/a
Default increasing and decreasing a value in a cell


Well I would have Current Stock in cell C3 separate from initial stock
in B3,
and following event macro in worksheet module :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OldVal As Variant, NewVal As Variant
If Target.Count 1 Then Exit Sub
Application.EnableEvents = False
Set Target = Range("B4")
NewVal = Target.Value
Application.Undo
OldVal = Target.Value
Range("C3").Value = Range("B3").Value + Range("B5").Value + NewVal +
OldVal
Target.Value = NewVal
Application.EnableEvents = True
End Sub

HTH
Carim
:)


--
Carim
------------------------------------------------------------------------
Carim's Profile: http://www.excelforum.com/member.php...o&userid=33259
View this thread: http://www.excelforum.com/showthread...hreadid=532926

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
cwal
 
Posts: n/a
Default increasing and decreasing a value in a cell


aha Carim,

I see where you went with this.... I will try this as soon as I can.
Many thanks for the help and good job decyphering my initial post!

regards,
CWAL


--
cwal
------------------------------------------------------------------------
cwal's Profile: http://www.excelforum.com/member.php...o&userid=33493
View this thread: http://www.excelforum.com/showthread...hreadid=532926

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



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