+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : 'Countif' with 'indirect' formulas needed

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    Warwickshire, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    'Countif' with 'indirect' formulas needed

    Hi there,

    I am working on a spreadsheet in excel 2007 involving a number of copy and paste macros. They move data from one sheet onto another sheet by shifting all existing data (on the sheet the data is moving to) down one row, and then pasting the new values in. This is working well but I want to put in a simple countif formula, like so:


    Please Login or Register  to view this content.
    However, when the new data shifts in, the B2 becomes B3 and the B367 becomes B368 and then this carries on so it is only ever counting the first piece of data that was entered.

    How can I rectify this, I have read about indirect formulas, however I cannot get these to work, and using $B$2 doesn't work either, although you're probably just thinking why would i even bother trying that anyway!!

    I have a very similar problem with cumulative addition formulas in cells (the answer may be very similar). I wish to add 2 cells, (not next to each other) the values of which will change since the data is shifting down one space each time with a copy and paste macro? could anyone supply a formula for that too please.

    Many thanks,
    Matt
    Last edited by JBeaucaire; 07-16-2012 at 12:56 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: 'Countif' with 'indirect' formulas needed

    Depending on how your macro works, you could change your formula to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then when a row is added above row 2, the array in your formula automatically expands.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: 'Countif' with 'indirect' formulas needed

    Any reason not to use:

    =COUNTIF(B:B,">0")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    07-16-2012
    Location
    Warwickshire, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: 'Countif' with 'indirect' formulas needed

    There was before, but after you posted that, i've changed some coding bits around so stuff is grabbed from different places and now I'll use b:b, thanks

    Worked all the other stuff out too, thanks for your help guys
    Last edited by Matt05D; 07-16-2012 at 03:40 PM.

+ 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