+ Reply to Thread
Results 1 to 9 of 9

Formula to return 0 if number of unique values in a row is greater than 1

  1. #1
    Registered User
    Join Date
    09-13-2016
    Location
    Cesenatico, Italy
    MS-Off Ver
    365
    Posts
    16

    Formula to return 0 if number of unique values in a row is greater than 1

    Problem description:

    I have a production process consisting of 14 stages/steps (columns A to N).

    I have six employees (cells A2 to A7, each employee is a number - 4, 5, 6, 14, 18 and 23).

    I need a formula that reads cells A2-N2 and, if the number of employees involved in the production process is greater than 1, the result must be 0 (zero). If the number of employees involved in the production is 1 (regardless of the number of production stages in which this employee was involved) then the result must equal to the employee number.

    Thank you in advance for your help with this formula.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by SurfexcelIT; 09-13-2016 at 09:02 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Need help with a formula

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    09-13-2016
    Location
    Cesenatico, Italy
    MS-Off Ver
    365
    Posts
    16

    Re: Need help with a formula

    Thank you and apologies.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Need help with a formula

    Here, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Where in your case range is Table1[@[Stage 1]:[Stage 14]]
    Attached Files Attached Files

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Formula to return 0 if number of unique values in a row is greater than 1

    This would be even better in case you don't assign numbers in the order (ie Stage1 0, Stage2 0, Stage3 23)

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Replace ; with , if you get error.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,916

    Re: Formula to return 0 if number of unique values in a row is greater than 1

    Or ...

    =IF(COUNTIF(Table1[@[Stage 1]:[Stage 14]],[@[Stage 1]])=COUNTIF(Table1[@[Stage 1]:[Stage 14]],">0"),[@[Stage 1]],0)

  7. #7
    Registered User
    Join Date
    09-13-2016
    Location
    Cesenatico, Italy
    MS-Off Ver
    365
    Posts
    16

    Re: Formula to return 0 if number of unique values in a row is greater than 1

    Zbor: this is great, thank you. However, we are quite there yet. Let's take row 7 for example. If the employee number is logged only under column C, the result changes to 0, even if only one employee is logged between A7:N7. Can the formula be extended to capture columns B:N? Thanks again!

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Formula to return 0 if number of unique values in a row is greater than 1

    See post #5.

    Also for Phuocam formula that would be like:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-13-2016
    Location
    Cesenatico, Italy
    MS-Off Ver
    365
    Posts
    16

    Re: Formula to return 0 if number of unique values in a row is greater than 1

    Zbor: Brilliant! Thanks so much. Problem solved.
    Phuocam: Thanks so much!

+ 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: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04: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