+ Reply to Thread
Results 1 to 22 of 22

Need Formula that dosent count if the adjacent cell was already counted in

  1. #1
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Question Need Formula that dosent count if the adjacent cell was already counted in

    Here is what I have so far.

    (COUNTIF(Admission!H:H,"<=-24")+COUNTIF(Admission!I:I,"<=-24")+(COUNTIF(Admission!L:L,"<=-24")+(COUNTIF(Admission!O:O,"<=-24")+COUNTIF(Admission!H:H,"#")+COUNTIF(Admission!I:I,"#")+COUNTIF(Admission!L:L,"#Value!")+COUNTIF(Admission!H:H,">720")+COUNTIF(Admission!I:I,">720"))))

    Basically what I need it to do is not double count if any of the criteria in Column "H:H", Column "I:I", Column "L:L", and Column "O:O" were already counted.

    For example if Column "H:H, "<=-24 and Column "I:I", "<=-24" I only want it to be counted as once and not twice. Because COUNTIF(Admission!H:H,"<=-24")+COUNTIF(Admission!I:I,"<=-24") will result in a total of 2 and I need it to result in a total of 1.
    Last edited by Drscott21; 04-08-2016 at 08:59 AM. Reason: SOLVED

  2. #2
    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,352

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Try

    =SUM(IF(((H1:H1000<=-24)+(I1:I1000=-24)+(L1:L1000=-24)+(O1:O1000<=-24)),1,0))

    Entered with Ctrl+Shift+Enter

    I defined the ranges rather than whole columns as it is an array formula so there are performance considerations.

  3. #3
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Didn't work.

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

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Worked on a sample I used (assuming I understood your requirement correctly). any row will only return 1 even if there 4 entries in it,

    Post a sample file showing expected results.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    I suggest a helper column

    Say column P on the Admission tab for example.

    In P2 and filled down put
    =MIN(H2,I2,L2,O2)

    Now use
    =COUNTIF(Admission!P:P,"<=-24")

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Wait, the MIN part would return alot of 0's if the H I L and O cells are empty..
    Change that to
    =IF(COUNT(H2,I2,L2,O2),MIN(H2,I2,L2,O2),"")

  7. #7
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Didn't work.
    It is still double counting the numbers.

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Can you attach a sample file showing about 10 rows or so, plus your expected results?

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).

  9. #9
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    I am attaching a the file, everything in light red I need it to only count once, for example if a cell in Column H is light red and a cell in column I,L, or O is light red it only counts as one and not 4. This is what I a formula for. I made references to specific rows in the attachment they are row 128 and row 150. They have arrows pointing to referenced cells.
    Thank you in advance for any help.
    When trying to view the attachment you have to down load it first. And then go to the Admission Worksheet.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    I just attached a the file

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    I can't say I understand what the formula is supposed to be doing.
    But I'd suggest a helper column, in say column P
    P2 and filled down put

    =MIN(H2,I2,L2,O2)

    Then (assuming the rest of your formula does what you want)
    =COUNTIF(Admission!P:P,"<=-24")+COUNTIF(Admission!H:H,"#")+COUNTIF(Admission!I:I,"#")+COUNTIF(Admission!L:L,"#Value!")+COUNTIF(Admission!H:H,">720")+COUNTIF(Admission!I:I,">720")

  12. #12
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    I want it to count the cells highlighted in light red because they are out of compliance. But I don't want it to double count cells if two cells in any row are highlighted light red. I guess that might make more sense. I was saying columns before.

  13. #13
    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,352

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    See results highlighted in green in column P (P128/P150) using my original formula: results of 1 !!!!!

    =IFERROR(SUM(IF((($H$1:$H$1000<=-24)+($I$1:$I$1000=-24)+($L$1:$L$1000=-24)+($O$1:$O$1000<=-24)),1,0)),"")
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    That is working so far but I also need it to count cells that contain #VALUE! and cells that contain "#" but still not double count them.

  15. #15
    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,352

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Or I have still misunderstood your requirement?

    I think formula could be ...

    =IFERROR(SUM(IF((($H2<=-24)+($I2<=-24)+($L2<=-24)+($2<=-24)),1,0)),"")

    Just check individual rows: Still same result.

  16. #16
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    I figured it out. The Working Formula is.

    =IFERROR(SUM(IF((($H$1:$H$1000<=-24)+($H$2:$H$1000="#")+($I$1:$I$1000<=-24)+($L$1:$L$1000<=-24)+($L$2:$L$1000="#")+($O$1:$O$1000<=-24)),1,0))," ")

  17. #17
    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,352

    Re: Need Formula that dosent count if the adjacent cell was already counted in the total.

    Try ..

    =IFERROR(SUM(IF(($H2<=-24)+($I2<=-24)+($L2<=-24)+($O2<=-24)+($H2="#")+($I2="#")+($L2="#")+($O2="#"),1,0)),"")

    #VALUE will raise an error condition so IFERROR will return 1 (rather than blank in previous formula).

  18. #18
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: [SOLVED] Need Formula that dosent count if the adjacent cell was already counted in

    I figured it out the final working formula is...

    =IFERROR(SUM(IF((($H$1:$H$1000<=-24)+($H$2:$H$1000="#")+($I$1:$I$1000<=-24)+($L$1:$L$1000<=-24)+($L$2:$L$1000="#")+($O$1:$O$1000<=-24)),1,0))," ")

  19. #19
    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,352

    Re: [SOLVED] Need Formula that dosent count if the adjacent cell was already counted in

    You don't need the range 1:1000 just the row as per formula in #17.

    Your formula does not count #VALUE errors: if you want them counted change the IFERROR(......., 1)

  20. #20
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: [SOLVED] Need Formula that dosent count if the adjacent cell was already counted in

    If I don't put 1:1000 it returns a value of 1 for every row.

  21. #21
    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,352

    Re: [SOLVED] Need Formula that dosent count if the adjacent cell was already counted in

    =IFERROR(SUM(IF(($H2<=-24)+($I2<=-24)+($L2<=-24)+($O2<=-24)+($H2="#")+($I2="#")+($L2="#")+($O2="#"),1,0)),1)

    Works OK for me!

  22. #22
    Registered User
    Join Date
    03-22-2016
    Location
    United States, NC
    MS-Off Ver
    2010
    Posts
    40

    Re: [SOLVED] Need Formula that dosent count if the adjacent cell was already counted in

    You are correct it works now. thanks.

+ 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. Replies: 4
    Last Post: 02-11-2015, 09:02 AM
  2. Replies: 1
    Last Post: 12-15-2014, 09:49 AM
  3. Formula to count/total items in non-adjacent cells
    By mpatsis in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-24-2014, 01:42 AM
  4. Formula to count/total items in non-adjacent cells
    By mpatsis in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-24-2014, 01:06 AM
  5. [SOLVED] Formula needed to only count total cells entered and not count adjacent text entered cells
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-07-2013, 06:22 PM
  6. [SOLVED] A formula to count adjacent cell values?
    By Nate Westcott in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-06-2012, 10:15 PM
  7. How do I set up the formula so that the A is counted?.-Count If
    By calli in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 02-06-2008, 02:05 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