+ Reply to Thread
Results 1 to 8 of 8

Need help understanding how to combine Count and Indirect

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Need help understanding how to combine Count and Indirect

    Im working on a solution right now and I'm trying to combine Count and Indirect but I don't understand what the [a1] section is supposed to be

    =count(indirect(c4:c10, [a1]))

    C4:C10 is the range of possible types that I want to count and Im guessing [a1] has to be one of the types from the range so that it can produce a count but it wont work.

    Am I misunderstanding the function?

    Thanks,

    -A

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,786

    Re: Need help understanding how to combine Count and Indirect

    Are you confusing it with COUNTIF?

    Pete

  3. #3
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Need help understanding how to combine Count and Indirect

    Quote Originally Posted by Pete_UK View Post
    Are you confusing it with COUNTIF?

    Pete
    thanks for the reply Pete.

    Isn't the [a1] part from the indirect function? Im trying to count the number of identical cells from a column then put it in a table. I'm using the indirect function so that I can drag the values across.

    I think the formula should be =count(indirect(C4:C10 but I don't get how Im supposed to count the value of the text.

    So for the column C4:C10 the values are Product A, Product B, Product C and Product D but how do I add that to the formula so that I can count the number of times they are used?

    Thanks

    -A

  4. #4
    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
    52,942

    Re: Need help understanding how to combine Count and Indirect

    I think Pete is right, try using =countif()

    =countif($c$4:$c$10,a1)

    indirect() is used when you want to reference a cell containing text (or a number) for use in a formula. So, for instance, you could use indirect() to include a sheet name that you might have on sheet1, that you want to use to pull in data from different sheets.

    If you have cell B1 with the text sheet2 in it, and call A1 =INDIRECT(B1&"!A1") every time you change the value in B1 to a different sheet name, it will return the value of that cell in that respective sheet
    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

  5. #5
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Need help understanding how to combine Count and Indirect

    Quote Originally Posted by FDibbins View Post
    I think Pete is right, try using =countif()

    =countif($c$4:$c$10,a1)

    indirect() is used when you want to reference a cell containing text (or a number) for use in a formula. So, for instance, you could use indirect() to include a sheet name that you might have on sheet1, that you want to use to pull in data from different sheets.

    If you have cell B1 with the text sheet2 in it, and call A1 =INDIRECT(B1&"!A1") every time you change the value in B1 to a different sheet name, it will return the value of that cell in that respective sheet
    Thanks FDibbins that does make sense but what if the situation is like the attached. Shouldn't I use indirect then? The document that Im using is really large so I've shortened it down. The red text are the numbers that I have been trying to populate. Since the values I'm searching are text like "1.0.A.3" then I thought the indirect made sense along with the count but Im not sure how to get it so that I can insert a function in F4 and then drag it to H5.

    Let me know if that doesn't make sense. Appreciate everyone's help!

    Thanks,

    -AExampleofQ.xlsx

  6. #6
    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
    52,942

    Re: Need help understanding how to combine Count and Indirect

    see if the attached is what you want? I had to include a helper column to populate the divisions (it was the simplest way), you can hide this if required.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Need help understanding how to combine Count and Indirect

    Quote Originally Posted by FDibbins View Post
    see if the attached is what you want? I had to include a helper column to populate the divisions (it was the simplest way), you can hide this if required.
    That should work. Appreciate the help FDibbins and Pete!

  8. #8
    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
    52,942

    Re: Need help understanding how to combine Count and Indirect

    Happy to help

+ 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