+ Reply to Thread
Results 1 to 6 of 6

Formula with non fixed row number

Hybrid View

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Formula with non fixed row number

    Hi,
    I wonder if this is possible.

    For instance I have a formula such as =sum(A1:A9). But imagine that the range is not always till row 9 but depends on the total number of rows that are in the table. How can I change that 9 so that it takes a number equal to the total rows in the table?

    N.B.: Please note that the final formula I want is not that simple one. It is actually =INDEX($F$1:$F$1047,MATCH(1,INDEX(($G$1:$G$1047=G2)*($L$1:$L$1047<>"47200")*($L$1:$L$1047<>"47700"),0),0)). I want to change 1047 by the relevant number of rows. Also, I do know how to do it in VBA, but I have a problem with the lenght of the formula there (not that one, but other bigger than that)

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,621

    Re: Formula with non fixed row number

    You could use Dynamic ranges for example

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Formula with non fixed row number

    Names... Yes, but, I am not really very fond of names. Is there any other way?

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Formula with non fixed row number

    Hello Shardin,

    You can apply those formulas directly in formula. Assuming column G is always be text entries.

    =INDEX($F$1:$F$100000,MATCH(1,INDEX(($G$1:INDEX($G:$G,MATCH("ZZZZZ",$G:$G))=G2)*($L$1:INDEX($L:$L,MATCH("ZZZZZ",$G:$G))<>"47200")*($L$1:INDEX($L:$L,MATCH("ZZZZZ",$G:$G))<>"47700"),0),0))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula with non fixed row number

    I put this together for another member, maybe you can adapt it to what you want? If you have a table of data like this...
    F
    1
    1
    2
    2
    3
    3
    4
    4
    5
    5
    6
    6
    7
    7
    8
    8
    9
    9
    10
    10
    11
    11
    12
    12
    13
    13
    14
    14
    15
    15
    16
    16
    17
    17
    18
    18
    19
    19
    20
    20
    21
    21
    22
    22


    Take this approach...
    B
    C
    D
    1
    Start Stop
    2
    5
    12
    3
    4
    OFFSET INDIRECT
    5
    SUM
    68
    6800
    6
    COUNTIF >8
    5
    5
    7
    COUNTIF =8
    1
    1
    8
    MAX
    12
    12


    C2:D2 are the start and stop rows (more on that later)
    C5=SUM(OFFSET($F$1,$C$2-1,0,D2-C2+1,1))
    C6=COUNTIF(OFFSET($F$1,$C$2-1,0,D2-C2+1,1),">=8")
    C7=COUNTIF(OFFSET($F$1,$C$2-1,0,D2-C2+1,1),"8")
    C8=MAX(OFFSET($F$1,$C$2-1,0,D2-C2+1,1))

    Alternatively...
    D5=SUM(INDIRECT("H"&$C$2&":H"&$D$2))
    D6=COUNTIF(INDIRECT("F"&$C$2&":F"&$D$2),">=8")
    D7=COUNTIF(INDIRECT("F"&$C$2&":F"&$D$2),8)
    D8=MAX(INDIRECT("F"&$C$2&":F"&$D$2))

    Now, in D2, you could have something like a counta() function that will count the number of entries (minus any rows for headings etc)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Formula with non fixed row number

    Yes! The INDIRECT way is what I was looking for.
    Thanks Ford, and all.

+ 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. [SOLVED] Fixed Cell Reference Minus a Fixed Number
    By juddykong in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-03-2013, 03:25 PM
  2. Help with formula to auto add a fixed number
    By Dougie12. in forum Excel General
    Replies: 3
    Last Post: 01-24-2012, 04:13 AM
  3. Replies: 2
    Last Post: 11-22-2011, 12:33 PM
  4. Replies: 4
    Last Post: 03-10-2009, 11:42 PM
  5. Add formula based on a fixed number
    By Manos in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2005, 04:05 AM

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