Subtract 1 from Each Number in Column
I have a column of quantities in excel and I want to subtract 1 fro
each of these numbers, unless the number is already zero. Any idea ho to do that? Thanks -- Message posted from http://www.ExcelForum.com |
Subtract 1 from Each Number in Column
Hi
and what should happen to values like 0.5? -- Regards Frank Kabel Frankfurt, Germany I have a column of quantities in excel and I want to subtract 1 from each of these numbers, unless the number is already zero. Any idea how to do that? Thanks! --- Message posted from http://www.ExcelForum.com/ |
Subtract 1 from Each Number in Column
for each cell in selection
if isnumeric(cell.Value) then if cell.Value 1 then if not cell.Hasformula then cell.Value = cell.Value - 1 end if end if End if Next or set rng = Selection.SpecialCells(xlConstants,xlNumbers) for cell in rng if cell.Value 0 then cell.Value = Cell.Value - 1 end if Next -- Regards, Tom Ogilvy "ani " wrote in message ... I have a column of quantities in excel and I want to subtract 1 from each of these numbers, unless the number is already zero. Any idea how to do that? Thanks! --- Message posted from http://www.ExcelForum.com/ |
Subtract 1 from Each Number in Column
Sounds like an inventory program.
-- Regards, Tom Ogilvy "Frank Kabel" wrote in message ... Hi and what should happen to values like 0.5? -- Regards Frank Kabel Frankfurt, Germany I have a column of quantities in excel and I want to subtract 1 from each of these numbers, unless the number is already zero. Any idea how to do that? Thanks! --- Message posted from http://www.ExcelForum.com/ |
Subtract 1 from Each Number in Column
|
All times are GMT +1. The time now is 12:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com