+ Reply to Thread
Results 1 to 3 of 3

count in column and restrict output

  1. #1
    Registered User
    Join Date
    08-30-2008
    Location
    London
    Posts
    35

    count in column and restrict output

    Hi All,

    A quick question for you guys im strugling on. I have a value at the top of my sheet in column A row 1. The value is the result of a lookup and it is a number between 50 and 100.

    On the same sheet I have rows starting at row 5 and working their way down to about 200. In col D of rows 5 to 200 is a value in each row and what I need to do is to only display as many of the rows between 5 and 200 that add up from the top to the value in A1.

    So an example is
    A1 shows as 50
    D5 = 10
    D6 = 12
    D7 = 10
    D8 = 10
    D9 = 10


    So in this case there is the option of adding up D5:D8 and only having 42 or adding D5:D9 and achieving 52. I always need to go for the figure or slightly above.

    Is there any way to do this? I hope i explained it well enough, let me know if you want me to elaborate.

    Many Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Something like this:

    =IF(SUM($D$5:D5)<$A$1+5,D5,"")

    copied down to row 200

    Note: The +5 allows for "slightly" over your A1 value by a maximum of 5 more.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-30-2008
    Location
    London
    Posts
    35
    thanks a lot that solves it just right

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Restrict values on columns
    By parthaemail in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-09-2007, 02:42 PM
  2. Restricting the search to one column
    By cheaperThanAPro in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-11-2007, 04:49 PM
  3. Restrict edit cell,row, column
    By tanksalevikrant in forum Excel General
    Replies: 1
    Last Post: 05-10-2007, 03:58 AM
  4. Restrict column adding and widening
    By mattsgr1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-07-2007, 07:31 AM
  5. How do I restrict characters whilst retaining complete words?
    By trafficbroker in forum Excel General
    Replies: 0
    Last Post: 10-11-2006, 01:07 PM

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