+ Reply to Thread
Results 1 to 16 of 16

I need a logical formula with 3 outcomes

  1. #1
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    I need a logical formula with 3 outcomes

    I am comparing two sets of data where a customer can have multiple products, up to about 16, each listed on a separate row. I need a formula that can compare the two lists and return a result.
    If the two products (cells) match I want to return "match"
    If the two products (cells) don't match but are populated (i.e. not blank) I want to return "mismatch"
    If there is a product in one of the two cells but the other cell is blank I want to return "no match"
    I have tried messing about with IF's and AND's but cannot seem to get the right result across all the permutations.
    Thanks

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: I need a logical formula with 3 outcomes

    It would help if you attached a sample Excel workbook, so that we can see how your data is laid out.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Please note that the Paperclip icon (Attachments button) does not work on this forum, so don't try to use that.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    Re: I need a logical formula with 3 outcomes

    Please see attached, I have annonymised the data.
    The Service Description from Source 1 is to match up against the Material Description in Source 2. There are gaps in the data where it doesnt exist in one of the soruces. The contract numbers are there to match up the customers as they dont all have the same names. Quantity, value and total can be ignored at this time.
    Attached Files Attached Files

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: I need a logical formula with 3 outcomes

    I don't know I could get your query or not

    but try

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


    Copy down.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  5. #5
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    Re: I need a logical formula with 3 outcomes

    Hi Shukla, thanks for your help but the mismatch part is missing. All the mismatches are treated the same as no matches.

  6. #6
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: I need a logical formula with 3 outcomes

    Can you please updated expected result in attached excel workbook.

  7. #7
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    Re: I need a logical formula with 3 outcomes

    Sure, please see attached
    Attached Files Attached Files

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

    Re: I need a logical formula with 3 outcomes

    Try:

    =IF(COUNTIFS($A$3:$A$40,G3,$B$3:$B$40,H3,$C$3:$C$40,I3),"match",
    IF(COUNTIFS($B$3:$B$40,H3,$C$3:$C$40,I3)+COUNTIFS($A$3:$A$40,G3,$B$3:$B$40,H3)+COUNTIFS($A$3:$A$40,G3,$C$3:$C$40,I3),
    "mismatch","no match"))

  9. #9
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: I need a logical formula with 3 outcomes

    Try

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


    Copy down!

  10. #10
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    Re: I need a logical formula with 3 outcomes

    That's great, both of your formula's give the same correct results except for the first row. They both say mismatch rather than no match.

  11. #11
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: I need a logical formula with 3 outcomes

    Try

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

  12. #12
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    Re: I need a logical formula with 3 outcomes

    Perfect, thank you Shakla!

  13. #13
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: I need a logical formula with 3 outcomes

    Glad it helps you
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks. If you liked any solution please add reputation by clicking star icon left corner of your screen.

  14. #14
    Registered User
    Join Date
    04-26-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    7

    Re: I need a logical formula with 3 outcomes

    Hello again, I've hit a slight problem. Whilst your formula worked i can see that you have used the customer names in there as well. In the actual spreadsheet these are not always the same, in fact in most cases they're not. There's different formatting, i.e. underscores instead of spaces and some time different suffixes, i.e. Ltd and Limited etc. Therfore I need reference to the customer names removed. I tried this and it worked, but then i hit the snag of mismatches and nomatches where there shouldn't be.
    I've uploaded some more data into the spreadsheet and you can see what i've added at the bottom. Throughout the spreadsheet i've aligned the horizontal rows where they should be aligned so would be happy if the searches just took place across the row rather than down the whole column. Unfortunately i'm not adept enough to make the alteration to the formula myslef.
    Thanks.
    Attached Files Attached Files

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: I need a logical formula with 3 outcomes

    I'm late to the party.

    This works with sample data.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: I need a logical formula with 3 outcomes

    Quote Originally Posted by Charken View Post
    ....
    I've uploaded some more data into the spreadsheet and you can see what i've added at the bottom. Throughout the spreadsheet i've aligned the horizontal rows where they should be aligned so would be happy if the searches just took place across the row rather than down the whole column. ......
    Please check row 64. Is there any chance that should be a "mismatch". The rest of the returns agree with the expected using this formula except for that one, and I believe this formula is correct. (See the X check column)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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] IF AND Formula multiple outcomes
    By McCaughley7 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-03-2016, 09:14 AM
  2. [SOLVED] IF(OR Formula with 4 criteria and 2 outcomes
    By PsychicFish in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-21-2016, 09:20 PM
  3. If or formula help for 3 possible outcomes
    By pembr0ke in forum Excel General
    Replies: 7
    Last Post: 02-08-2016, 07:41 AM
  4. Three value outcomes for one logical test- 'If' formula?
    By lewises in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-16-2014, 08:33 AM
  5. [SOLVED] IF Formula with 3 outcomes
    By adamheon in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2013, 10:13 AM
  6. Multiple logical functions resulting in multiple outcomes
    By PaddyG in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-13-2012, 12:20 PM
  7. Multiple outcomes from a logical formula
    By JoeHan in forum Excel General
    Replies: 6
    Last Post: 05-24-2012, 05:54 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