+ Reply to Thread
Results 1 to 18 of 18

Is it possible to use the indirect function like this.

  1. #1
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Post Is it possible to use the indirect function like this.

    Hi guys

    I have Exel 2016

    Im trying to use the CountIf function. It works well here: =COUNTIF($A$1:$A$5,"<="&$A1)

    but the issue is It uses $A$1:$A$5 for everything. if i change the code to COUNTIF($A1:$A5,"<="&$A3) and remove the dollar symbol then it doesnt preserve the range at all and produces different results for every single row.

    I need it to isolate a1 to a5 range while im working with any row that goes with 1-5. otherwise i will have to create new formulas for every range.

    When i use a6 i need it to change the range to a6 - a 11 and so forth..

    I tried to use the INDIRECT feature but I just get endless errors.

    Any help is appreciated.


    EDIT:

    The issue is it goes to a7-a10 right after that and changes with every row

    I wanted to isolate each range and treat a1-a5 as a group.
    I wanted to sort all the values of a1-a5 into consecutive order and so I needed a1-a5 to remain focused on a1-a5 until it reaches a6.
    So im pretty much trying to isolate each group and sort the values from smallest to largest. If it changes with each row then its not doing the right comparisons with all available values. So im struggling with that

    So Im pretty much trying to get eg:
    a1-a5 in consecutive order
    a6-a10 in consecutive order
    a11-a15 in consecutive order

    and so forth.

    I was going to use =INDEX($A$1:$A$5,MATCH(ROWS($C$1:C4),$C$1:$C$5,0)) to help me organise everything afterwards. but yeah i got stuck.
    Last edited by FanAnd22; 04-06-2019 at 06:51 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to use the indirect function like this.

    So, you want
    Countif(A1:A5 <= A1), COUNTIF(A1:A5<=A2), COUNTIF(A1:A5<=A3) …
    Then COUNTIF(A6:A10<=A6), ….. Correct?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Is it possible to use the indirect function like this.

    try this

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,703

    Re: Is it possible to use the indirect function like this.

    Welcome to the Forum FanAnd22!

    First you said that it "produces different results for every single row", which sounds like a description of a problem. Then you say, "When i use a6 i need it to change the range to a6 - a 11 and so forth." which sounds like you want it to produce different results for every single row.

    Rather than having us go on a chase for COUNTIF, please describe from the beginning what your data looks like and what result you are trying to get.

    If you use

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    in row 1, then it will count the occurrences <= A3 in rows 1-5.

    If you copy that formula to row 6, it will be

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    How is that different than what you want to happen?
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by ChemistB View Post
    So, you want
    Countif(A1:A5 <= A1), COUNTIF(A1:A5<=A2), COUNTIF(A1:A5<=A3) …
    Then COUNTIF(A6:A10<=A6), ….. Correct?
    hi Chemist B. Yes exactly!

  6. #6
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by Roel Jongman View Post
    try this

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Hi Roel. I just get an error, Im not sure if theres something i missed.

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to use the indirect function like this.

    Try this formula in B1 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to use the indirect function like this.

    A cleaner formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by 6StringJazzer View Post
    Welcome to the Forum FanAnd22!

    First you said that it "produces different results for every single row", which sounds like a description of a problem. Then you say, "When i use a6 i need it to change the range to a6 - a 11 and so forth." which sounds like you want it to produce different results for every single row.

    Rather than having us go on a chase for COUNTIF, please describe from the beginning what your data looks like and what result you are trying to get.

    If you use

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    in row 1, then it will count the occurrences <= A3 in rows 1-5.

    If you copy that formula to row 6, it will be

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    How is that different than what you want to happen?

    Hi 6string. thanks for the reply and thank you, I copied the code

    What i get is a6 - a10, yes

    The issue is it goes to a7-a10 right after that and changes with every row

    I wanted to isolate each range and treat a1-a5 as a group.
    I wanted to sort all the values of a1-a5 into consecutive order and so I needed a1-a5 to remain focused on a1-a5 until it reaches a6.
    So im pretty much trying to isolate each group and sort the values from smallest to largest. If it changes with each row then its not doing the right comparisons with all available values. So im struggling with that

    So Im pretty much trying to get eg:
    a1-a5 in consecutive order
    a6-a10 in consecutive order
    a11-a15 in consecutive order

    and so forth.

    I was going to use =INDEX($A$1:$A$5,MATCH(ROWS($C$1:C4),$C$1:$C$5,0)) to help me organise everything afterwards. but yeah i got stuck.

  10. #10
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by ChemistB View Post
    A cleaner formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thank you ChemistB! its works perfectly! thanks

  11. #11
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    I just need to try get the =INDEX($A$1:$A$5,MATCH(ROWS($C$1:C4),$C$1:$C$5,0)) part

  12. #12
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    This is more complex than i thought. Can anyone help?

    been reading for a few hours

    I saw some examples of offset and match being used together rather than index but im imagining i would need to employ offset within match aswell considering the variable will always be changing. Havent found an example thats like mine.


    At first I tried to direcetly edit =INDEX($A$1:$A$5,MATCH(ROWS($C$1:C4),$C$1:$C$5,0)) but it turned into a mess

  13. #13
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to use the indirect function like this.

    Is this the same problem or is this a different issue? My formula doesn't require a INDEX/MATCH portion. Are you just looking for different alternatives?

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by ChemistB View Post
    A cleaner formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    A non-volatile somewhere between your orignial and cleaner versions.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    edit:- Just realised what the OP is trying to do after reading post #9 again

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by jason.b75; 04-05-2019 at 03:16 PM.

  15. #15
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by ChemistB View Post
    Is this the same problem or is this a different issue? My formula doesn't require a INDEX/MATCH portion. Are you just looking for different alternatives?
    Hi Chemist. No, the solution was perfect. It was a differnt issue. I wanted to output everything in consecutive order with =INDEX($A$1:$A$5,MATCH(ROWS($C$1:C4),$C$1:$C$5,0))

    but i couldnt figure out how to apply what you had suggested to this extra step. Sorry for confusion

  16. #16
    Registered User
    Join Date
    04-05-2019
    Location
    cape town
    MS-Off Ver
    2016
    Posts
    16

    Re: Is it possible to use the indirect function like this.

    Quote Originally Posted by jason.b75 View Post
    A non-volatile somewhere between your orignial and cleaner versions.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    edit:- Just realised what the OP is trying to do after reading post #9 again

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Hi Jason. Thank you. Thank you. its works!
    Sorry for the lack of clarification. Really appreciate it


    I'll edit post 1 aswell for anyone reading who may have the same problem

  17. #17
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to use the indirect function like this.

    @Jason: What's the advantage of AGGREGATE over just using LARGE? Just in case, your data has issues?
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  18. #18
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Is it possible to use the indirect function like this.

    I don't think that there is any specific advantage other than the options to ignore errors or nested subtotals (if applicable).

    With LARGE(IF( arrays, AGGREGATE appears to be the method of choice for many (myself included once I figured out how the logic works). As I tend to use LARGE / SMALL with such arrays more than ranges, it has become habit to use AGGREGATE even when it is not needed.
    Last edited by jason.b75; 04-05-2019 at 04:51 PM.

+ 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. Is INDIRECT function volatile within an IF function?
    By Monimonika in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2017, 12:53 PM
  2. [SOLVED] INDIRECT Function with multiple sheets - SUMIF, INDIRECT & MATCH
    By DJDRU in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-07-2014, 08:42 AM
  3. Using Indirect function inside the Search function
    By skhari in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-20-2014, 05:32 PM
  4. [SOLVED] Combining Text Function with Indirect Function
    By ninmjj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2013, 10:34 AM
  5. Sumif function using indirect function and data from different sheet
    By pronky007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2013, 12:40 PM
  6. [SOLVED] Using ROW function inside of both an Indirect and Index function returns #VALUE
    By xandermacleod in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-11-2012, 06:22 PM
  7. MATCH function within INDIRECT function not working
    By mgerada in forum Excel General
    Replies: 2
    Last Post: 09-04-2011, 08:37 AM

Tags for this Thread

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