+ Reply to Thread
Results 1 to 10 of 10

Count based on corresponding column on another worksheet

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Schaumburg, IL
    MS-Off Ver
    Excel 2007
    Posts
    24

    Count based on corresponding column on another worksheet

    Issue solved. Thanks.

    --Original Post --

    Hi. Been at this all day and just can’t figure this out so, I hope you guys can show me the way.

    My Excel file has 3 worksheets, “audit”, “staff”, and results”. The “audit” worksheet has columns for Name (C1), Type (D1), Year (E1), and Taxes (F1). The “staff” worksheet has columns for Name (B1) and Region (C1). The Names in the “audit” and “staff” worksheet are identical. The “results” worksheet has columns named Region 01 (E6), Region 02 (F6), and Region 03 (G6), and cells E8, F8, and G8 will contain the formula in question for each region.

    For each region I need the formula to display a count of the rows in the “audit” work sheet where Type = “Sale”, Year = “”, and Taxes = “”. The “audit” tab does not contain a column for Region, but does have a Name column. The “staff” worksheet has the distinct names and their corresponding regions. This is where I get hung-up. How do I match the names in the “staff” worksheet and their corresponding regions to the Names in the “audit” worksheet so I can do a count by Region with the criteria for Type, Year, and Taxes?

    Thanks in advance for your assistance.

    I have uploaded a sample Excel file to illustrate the problem.
    Attached Files Attached Files
    Last edited by gdaniels; 10-29-2014 at 07:59 AM. Reason: Solved

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Count based on corresponding column on another worksheet

    Here is what you desired... ( I hope )
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    check the attached file..
    Attached Files Attached Files
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Cool Re: Count based on corresponding column on another worksheet

    That was the solution..
    But I request all experts to refer this case, if I wanna try something like this.
    Its not working up ( May be I am missing something )
    Actually I want to limit the no. of element in the Countif Criteria Argument by using Index Small If construction.. ( just to speed up the calculations..as more the countif criteria array elements, more slowy it will be.. )
    I tried to use Offset but problem remains..
    here it is..
    =SUMPRODUCT(COUNTIF(audit!$C$2:$C$724,INDEX(staff!$B$2:$B$93,SMALL(IF(staff!$C$2:$C$93=results!E$6,ROW($2:$93)-1),
    ROW(INDIRECT("1:"&COUNTIF(staff!$C$2:$C$93,results!E$6)))))
    ))
    Here is the attached file..
    Attached Files Attached Files
    Last edited by Vikas_Gautam; 10-28-2014 at 10:47 PM.

  4. #4
    Registered User
    Join Date
    02-10-2014
    Location
    Schaumburg, IL
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Count based on corresponding column on another worksheet

    Thanks, Vikas. I need the code to contain additional IF statements to also count only the rows where audit!$D:$D = "Sale", audit!$E:$E = "", and audit!$F:$F = "". I tried inserting IF statements for these in the code you provided, but I keep getting errors. I'd appreciate any further help. Thanks again.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: Count based on corresponding column on another worksheet

    Pl see attached file.
    Attached Files Attached Files

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Count based on corresponding column on another worksheet

    @Vikas Thanks for your private message.

    If you want to induce an array of returns using INDEX then you to apply some extra coercion to the row_num (or column_num) parameter, e.g. (array-entered):

    =SUM(COUNTIF(audit!$C$2:$C$724,INDEX(staff!$B$2:$B$93,N(IF(1,SMALL(IF(staff!$C$2:$C$93=results!E$6,ROW($2:$93)-1),ROW(INDIRECT("1:"&COUNTIF(staff!$C$2:$C$93,results!E$6)))))))))

    See here for more:

    http://excelxor.com/2014/08/23/index...ray-of-values/

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  7. #7
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Count based on corresponding column on another worksheet

    Fantastic XOR LX..
    You are Great..
    what an article.. , simply extra ordinary..
    Here is my way.. which I learnt by reading your articles..
    =SUM(COUNTIF(audit!$C$2:$C$724,INDEX(staff!$B$2:$B$93,SMALL(IF(staff!$C$2:$C$93=results!E$6,ROW($2:$93)-1),
    N(INDEX(ROW(INDIRECT("1:"&COUNTIF(staff!$C$2:$C$93,results!E$6))),))))))

    Thanks again for sharing your knowledge..
    I am highly obliged

    Regards,
    Attached Files Attached Files

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Count based on corresponding column on another worksheet

    You're welcome. Glad to share - that's one of the points of a forum, no?

  9. #9
    Registered User
    Join Date
    02-10-2014
    Location
    Schaumburg, IL
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Count based on corresponding column on another worksheet

    Much thanks to all for your time and help. Works flawlessly. Should have sought the answer in this forum first instead of spending hours trying to figure this out on my own, but it's like banging your head against a wall...it feels so good when you stop! Thanks again.
    Last edited by gdaniels; 10-29-2014 at 07:51 AM. Reason: typo

  10. #10
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Count based on corresponding column on another worksheet

    You are always welcome..

+ 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] Last Column count based on find.row count
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2014, 11:01 PM
  2. [SOLVED] Count the number of items sold in one column based on the quantity in another column
    By mike_m1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-20-2013, 05:48 AM
  3. Replies: 4
    Last Post: 12-04-2012, 02:24 AM
  4. Replies: 6
    Last Post: 06-20-2012, 06:24 PM
  5. Replies: 9
    Last Post: 06-08-2012, 06:22 PM

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