+ Reply to Thread
Results 1 to 4 of 4

performing identical calculation over a range of cells?

  1. #1
    Registered User
    Join Date
    09-26-2007
    Posts
    2

    performing identical calculation over a range of cells?

    I almost never use excel except as a glorified running total calculator, so bear this in mind as I try to go beyond that for the first time.

    Let's say I have a range of manually entered numbers in a column, such as b8:b20. Now lets say I want to subtract the same figure from each cell, a number located in B1, and only after that operation is completed then get a sum for the range of cells in b8:b20. I would only want this subtraction to occur if the number is greater than 0 (to avoid a negative number within the range where a blank cell was). I hope that wasn't too confusing.

    So how to I proceed?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,


    Without your zero criteria I would of suggested enter your neg number in say cell A1 and then copy cell A1 then select your range and right click to get the paste special box and click add and ok

    http://www.bettersolutions.com/excel...I216522111.htm

    As this is not a option then use a helper column ( e.g any available column)
    Say Col C. Enter this in C8 and drag down.

    =IF(B8>0,B8-10,B8) ...change -10 to your number

    Then drag down. Select the Col C range and copy then select B8 and paste special the values (See link).

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    09-26-2007
    Posts
    2
    I first posted this with a ambiguous title, which is why it got the boot I think. Sorry! Anyway, before that thread was deleted "NBVC" answered with:

    "Try:

    =SUM(IF(B8:B20<>0,B8:B20-B1))

    this must be confirmed with CTRL+SHIFT+ENTER not just ENTER...you should see { } brackets appear around the formula."


    It worked liked a charm. Thanks!

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad you got an answer.

    Please ensure you read the rules below so your post won't get deleted

    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1