+ Reply to Thread
Results 1 to 7 of 7

COUNTIF and SUMIF where the target cells cover more than 1 column

  1. #1
    Registered User
    Join Date
    12-01-2017
    Location
    Manc, England
    MS-Off Ver
    2007
    Posts
    20

    Question COUNTIF and SUMIF where the target cells cover more than 1 column

    Hi,

    I have been tasked with automating a report in work and I am struggling to link up parts of the data using formulas.

    I can count easily enough the instances where there are straightforward counts using SUMIF and COUNTIF to basically match the data on tabs 1 and 2 with the Summary, however, in instances where one of the people has a shared job with another person I need to count this separate in the Summary tab and to show that the shared job is split e.g. Person A and Person share a job, each needs to receive 50% of the value and to have the count of jobs they've done reflect that it is a 0.5 and not 1.

    I don't know if I am missing something extremely obvious and I should just be using SUMIFS and COUNTIFS, but they don't seem to do what I need. I have tried using AND and OR alterations but they just bring back True or False and not the values I need.

    Please can you help me?!

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: COUNTIF and SUMIF where the target cells cover more than 1 column

    Welcome to the forum!

    Where in your sample file are we meant to be looking?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    12-01-2017
    Location
    Manc, England
    MS-Off Ver
    2007
    Posts
    20

    Re: COUNTIF and SUMIF where the target cells cover more than 1 column

    Apologies,

    3rd Tab 'Summary' - specifically column range D-K.

    D-G looks at Tab 1 'IT' - need to count jobs completed as a whole and where applicable on shared jobs for half the value and half the job count.

    H-K looks at Tab 2 'Perm Corp Accounts' - same as above, needs to count whole jobs and jobs which are split.

    Thank you.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: COUNTIF and SUMIF where the target cells cover more than 1 column

    Try putting columns A and B in the COUNTIF and then dividing by 2, e.g.

    =COUNTIF(IT!$A$5:$B$37,Summary!A17)/2

    and for the SUMIFS you need two SUMIFS divided by 2

    =(SUMIF(IT!$A$5:$A$37,Summary!A17,IT!$P$5:$P$37)+SUMIF(IT!$B$5:$B$37,Summary!A17,IT!$P$5:$P$37))/2

    Does that do what you want? If not then please give some sample required results with an explanation, thanks
    Audere est facere

  5. #5
    Registered User
    Join Date
    12-01-2017
    Location
    Manc, England
    MS-Off Ver
    2007
    Posts
    20

    Re: COUNTIF and SUMIF where the target cells cover more than 1 column

    Hi,

    Thank you for coming back to me.

    I don't think it does do what I need it to do.

    By way of example I need it to do the following:

    Row 6 on the IT Tab should show that as it was Person A as both the first person and the second, therefore on the summary this should show in row D and E - Number of Deals = 1, Sale Value = £1,352. Which it does, but then, on row 8 of the IT Tab Person A is the second person on the deal, so in columns F & G it should pull through as - Number of Deals = 0.5, Sale Value = £744.50

    Therefore, Person A should have - Total Sales 1.5, Salve Value £2096.50

    The formulas you've suggested work, but in effect double count the split deals I have.

    e.g.

    Corporate Recruiters 0 £0.00 No.of Sales Sale value No.of Sales Sale value
    Person A 2.5 £3,448.50 1 £1,352.00 1.5 £2,096.50

    Person A
    Should be 1.5 £2096.50 1 £1,352.00 0.5 £744.50

    Person B 7 £30,142.32 3 £11,569.12 3 £17,115.20
    Person C 2.5 £6,812.98 1 £1,489.01 1.5 £5,323.97
    Person D 6 £25,298.44 3 £10,132.37 2 £11,602.07

    I need the formula to ID the person in each section, and then adjust values accordingly.

    Thank you for your help!

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: COUNTIF and SUMIF where the target cells cover more than 1 column

    Removed by JT
    Last edited by JohnTopley; 12-04-2017 at 07:56 AM. Reason: File aready provided

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: COUNTIF and SUMIF where the target cells cover more than 1 column

    Try

    in D17

    =COUNTIFS(IT!$A$5:$A$37,Summary!A17,IT!$B$5:$B$37,Summary!A17)

    in E17

    =SUMIFS(IT!$P$5:$P$37,IT!$A$5:$A$37,Summary!A17,IT!$B$5:$B$37,Summary!A17)

    in F17

    =(COUNTIFS(IT!$A$5:$A$37,Summary!A17,IT!$B$5:$B$37,"<>" &Summary!A17)+COUNTIFS(IT!$B$5:$B$37,Summary!A17,IT!$A$5:$A$37,"<>" &Summary!A17))*0.5

    in G17

    =(SUMIFS(IT!$P$5:$P$37,IT!$A$5:$A$37,Summary!A17,IT!$B$5:$B$37,"<>" &Summary!A17)+SUMIFS(IT!$P$5:$P$37,IT!$B$5:$B$37,Summary!A17,IT!$A$5:$A$37,"<>" &Summary!A17))*0.5


    EDIT:missed brackets

    Added corrected file
    Attached Files Attached Files
    Last edited by JohnTopley; 12-04-2017 at 10:22 AM.

+ 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. Target.column for Data Validation would like to target some cells within column
    By iggypop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2017, 12:35 PM
  2. [SOLVED] Update current dates in different cells when value in a Target column cells changes
    By sumit dey in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-15-2015, 03:06 AM
  3. [SOLVED] Need alternate syntax 'Select Case' on Target.Column and Target.Row at the same time.
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2012, 11:19 AM
  4. Can SUMIF and COUNTIF be used only with alternate cells?
    By random_viper102 in forum Excel General
    Replies: 3
    Last Post: 11-17-2009, 10:04 AM
  5. Sort column when using countif & sumif functions
    By kzprivate in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-20-2008, 08:33 PM
  6. [SOLVED] Extending sub to cover other target cells
    By Max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-06-2005, 06:35 PM
  7. [SOLVED] Reference Cells with Sumif or Countif
    By GK in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-03-2005, 02:06 PM

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