+ Reply to Thread
Results 1 to 10 of 10

Formula to check a service isn't selected more than once

  1. #1
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Formula to check a service isn't selected more than once

    Morning all,

    I have a number of different buildings and three different service types that are available. Each building can only receive one service. I'd like a formula to check that no building has more than one service requested against it.

    Example attached.

    Thanks in advance,

    Snook

  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,619

    Re: Formula to check a service isn't selected more than once

    How would it even be possible for any one building to select a service more than once? Your grid allows Yes or nothing, so what would you expect your pink box to say???

    Is this what you want?

    =COUNTA(C3:C5)>1
    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
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Formula to check a service isn't selected more than once

    or can try
    =IF(COUNTIF(C3:C5,"Yes")>1,"Multi","")
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  4. #4
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: Formula to check a service isn't selected more than once

    Hi Ali,

    The formula (pink cell) needs to check that each building (across the whole range) doesn't have a "Yes" count of more than 1. If it does I'd like the pink cell to show an output like 'Error'. I'm assuming I'll need an array formula?

    Does that make sense?

    Regards,

    Snook

  5. #5
    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,619

    Re: Formula to check a service isn't selected more than once

    OK - you still haven't said what you want it to return, though!

    EDIT: That was a quick edit!!!
    Last edited by AliGW; 07-06-2020 at 04:44 AM.

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Formula to check a service isn't selected more than once

    try
    =SUM((MMULT({1,1,1},(C3:L5="Yes")+0)=1)+0)
    or
    =SUMPRODUCT(((C3:L3="Yes")+(C4:L4="Yes")+(C5:L5="Yes")=1)+0)
    Last edited by samba_ravi; 07-06-2020 at 04:46 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: Formula to check a service isn't selected more than once

    Quote Originally Posted by The_Snook View Post
    If it does I'd like the pink cell to show an output like 'Error'.
    Cheers samba_ravi, that returns the number of compliant buildings. Can we get it to compare against the total number of buildings and generate a OK/ERROR output?

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

    Re: Formula to check a service isn't selected more than once

    Just amend it thus:

    =IF(SUM((MMULT({1,1,1},(C3:L5="Yes")+0)=1)+0) < COUNTA(C2:L2),"Error","OK")

  9. #9
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: Formula to check a service isn't selected more than once

    Magical, cheers both! Apologies for the Monday morning head masher!

  10. #10
    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,619

    Re: Formula to check a service isn't selected more than once

    Hardly, and would have been faster with an unambiguous opening post.

+ 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. Check if vehicle is within service and highlight
    By GHI1968 in forum Excel General
    Replies: 4
    Last Post: 07-03-2018, 08:50 PM
  2. [SOLVED] Check box formula to copy selected rows into another sheet
    By GlobalTr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2017, 10:51 PM
  3. Formula to check for vehicle service done
    By Noorking in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2014, 04:58 AM
  4. [SOLVED] \\bms\Service log request\login details\workstation cannot. Check your spelling or try a d
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2014, 10:40 AM
  5. [SOLVED] VBA Code to check if service is required for a machine in that month and create a pop-up
    By Learner1234 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2014, 02:38 PM
  6. Need a vba code to check the status and based on rules calculate service years
    By baba_excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-19-2012, 09:03 PM
  7. Need formula to tie cost of service to service code
    By mkrebs in forum Excel General
    Replies: 1
    Last Post: 03-23-2005, 01:53 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