I am trying to come up with a formula in excel. Here it is:
Rick,
Thanks for your help. I want a formula in the Calculation formula (K3)
that makes any negative number in column J (290 rows) 0. And to do
this, I have to change the Safety column. If you look at the numbers
up above, Safety should be 20 so that production will be 0.(25+20-45)
So, I am looking for a formula or a macro. I would appreciate your
help. Thanks
I don't think I am understanding what you want to do completely yet. I
assumed from your initial posting that you (or your spreadsheet's user) are
filling in values in columns G, H and I and that column J was being
calculated from it (Orders+Safety-Inventory which translates to H+I-G for
each row) and that, whenever any of these row calculations yielded a
negative value, you simply wanted to display a 0 instead. Your latest
posting seems to be saying you want to somehow physically change the value
in your I columns to force the calculation to 0 instead. My proposal does
not require this "forcing of column I to a different value than entered"
solution (nor does it even require the K column that you proposed). If my
first interpretation is correct (that you don't really **need** to change
the values in column I **except** to force column J to 0 wherever it
evaluates to 0), give my formula a try. Here is what I intended you to do
with it. Assuming your original "chart" of values
G H I J
Inventory Orders Safety Production
45 25 10 -10
means that those numbers are in row 3 to start, then place this formula in
J3
=--TEXT(H3+I3-G3,"0;\0")
and copy it down to the end of your data. Doing this will make column J
display either the individual row calculation H+I-G or zero depending on if
that calculation is positive or not. If you don't know how many rows are
going to be involved (or if the number of rows of information will grow with
time), and you don't want to display zeroes for rows where there are no
calculations, you can use this formula instead
=IF(ISNUMBER(I3),--TEXT(H3+I3-G3,"0;\0"),"")
and copy it down well past the last possible row you will ever have to deal
with (or, perhaps, simply copy it down to the bottom of the sheet) and
nothing will be displayed in the J column unless something is entered in the
I column.
Rick