+ Reply to Thread
Results 1 to 5 of 5

dynamic row cell counting

  1. #1
    Registered User
    Join Date
    02-20-2010
    Location
    manchester, uk
    MS-Off Ver
    Excel 2003
    Posts
    3

    dynamic row cell counting

    Hi guy's,

    if anyone can help me out i would really apprecicate it.

    i need to find the number of cells between the smallest and largest values in an array (between 2004:2010) per row. this number will be used as a divider to calc a rate per year.

    the divider column indicates the value required. i cant work out how to make the array dynamic.

    i thought that it could look like count(small(A1:A7,1):large(A1:A7,1))-1 but it did noy not pick up small(A1:A7,1):large(A1:A7,1) as an array.

    for example

    2004, 2005, 2006, 2007, 2008, 2009, 2010, Divider,
    0, 0.3, 0.6, 0, 0, 0, 0, 1,
    0.5, 0.5, 0, 0, 0.7, 0, 0, 3,
    0, 0.3, 0, 0, 0, 0.5, 0, 4,
    0.1, 0, 0, 0, 0.2, 0, 0, 4,
    0, 0, 0.9, 0, 1, 0, 0, 2,
    0, 0.2, 0, 0, 0, 0.8, 0, 4,
    0, 0, 0, 0.6, 0, 0, 1, 3,

    sorry i can't seem to insert a table "," indicates next cell.

    help would be fantastic, thanks in advance,

    liam.
    Last edited by l14mha; 02-20-2010 at 03:55 AM. Reason: bad formatting

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: dynamic row cell counting w

    Posting a sample file will help more than trying to embed a table.

    Your reference row 1 but table implies this is Year header ?

    Assuming the intention is to determine Column of Max and the Column of the Min and subtract the latter from the former then:

    H2: =MATCH(MAX(A2:G2),A2:G2,0)-MATCH(MIN(A2:G2),A2:G2,0)

    of course if there is only one value result would be 0 and use of this value as divisor would lead to #DIV/0!

    If the data points are always sorted in Ascending order then another alternative would be to use MATCH(9.99E+307,A2:G2,0) instead of MATCH(MAX...)

  3. #3
    Registered User
    Join Date
    02-20-2010
    Location
    manchester, uk
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: dynamic row cell counting w

    thank you very much.. that works a treat.

    the only bug is that 0,0,0.5,0.5,0,0,0.8 returns 4 and not 3. this is due to picking up on the left most 0.5 value and not the right.

    can this be resolved?

    thanks liam

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: dynamic row cell counting w

    If you have 0's in there then the MIN approach wouldn't work anyway as I see it.

    Do you have negative values ?

    Assuming

    a) no negatives

    b) zeroes to be ignored

    c) last instance of MIN/MAX to be used

    then

    H2:
    =LOOKUP(2,1/(A2:G2=MAX(A2:G2)),COLUMN(A2:G2))-LOOKUP(2,1/(A2:G2=SMALL(A2:G2,1+COUNTIF(A2:G2,0)),COLUMN(A2:G2))

  5. #5
    Registered User
    Join Date
    02-20-2010
    Location
    manchester, uk
    MS-Off Ver
    Excel 2003
    Posts
    3

    Thumbs up Re: dynamic row cell counting (SOLVED)

    thank you very much,

    i removed the 0's from my existing spread sheet and slightly modified your formula taking out the count if statement. they work well together now.

    SOLVED.

+ 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