Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ani ani is offline
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/




  #5   Report Post  
Posted to microsoft.public.excel.programming
ani ani is offline
external usenet poster
 
Posts: 1
Default Subtract 1 from Each Number in Column

the quantity can't be 0.5.

--
Message posted from http://www.ExcelForum.com

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
How do I subtract a negative number from a positive number? csanta Excel Discussion (Misc queries) 5 April 4th 23 10:15 AM
subtract column right from column left in excel? Muffin[_2_] New Users to Excel 2 June 17th 09 02:55 PM
subtract 10 from every number in a column gimianame Excel Worksheet Functions 1 August 11th 05 07:20 PM
how to subtract the very next LOWEST number maxkofe New Users to Excel 2 December 5th 04 06:06 PM
How can I subtract 111 from a number like 097 and get 987, using . Viper5963 Excel Worksheet Functions 6 November 8th 04 07:13 PM


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