+ Reply to Thread
Results 1 to 5 of 5

Using if and or formula for numbers in 2 columns to match numbers in 3 different columns

  1. #1
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    138

    Using if and or formula for numbers in 2 columns to match numbers in 3 different columns

    I have numbers in Columns A and B and i want to get a Y or N if these numbers are found in Columns C D or E.

    My formula is

    =IF(OR(A2=C2,A2=D2,A2=E2,B2=C2,B2=D2,B2=E2),"Y","N")

    But it shows Y all the way down.

    Also if all the Columns are blank I need the formula to also give me a blank in the Column where the Y and N occur.

    I have put the 6 columns on the sample spreadsheet and also what the correct results should be.

    Thanks in advance for any help.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Using if and or formula for numbers in 2 columns to match numbers in 3 different colum

    It's not working because you have empty cells that match empty cells, you need to address that 1st...
    =IF(OR(COUNT(A2:B2)=0,COUNT(C2:E2)=0),"N",IF(OR(MATCH(B2,C2:E2,0),MATCH(A2,C2:E2,0)),"Y","N"))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    138

    Re: Using if and or formula for numbers in 2 columns to match numbers in 3 different colum

    Thanks a lot Ford, I just didn't know how to make the formula skip the blank cells.

    I'm still learning about these advanced formulas (which are probably not advanced for you).

    Thanks for your help.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Using if and or formula for numbers in 2 columns to match numbers in 3 different colum

    Not a problem, happy to help.

    Most formulas a really not as advanced as they look. You just have to build and test the parts individually, then figure out how to combine them.

    - how to test for A and B being empty...
    COUNT(A2:B2)=0

    - how to test for C:E being empty...
    COUNT(C2:E2)=0)

    - Now, how to test for both, and what to do if either set is empty...
    OR(COUNT(A2:B2)=0,COUNT(C2:E2)=0),"N"

    The rest, I just took a different approach for the match...
    OR(MATCH(B2,C2:E2,0),MATCH(A2,C2:E2,0))

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Using if and or formula for numbers in 2 columns to match numbers in 3 different colum

    Thanks for the feedback

+ 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. Match 2 columns with 600 plus numbers
    By tdr0007 in forum Excel General
    Replies: 1
    Last Post: 02-23-2016, 07:30 AM
  2. Match 2 columns with 600 plus numbers
    By tdr0007 in forum Excel General
    Replies: 1
    Last Post: 02-22-2016, 10:57 PM
  3. i need to sort three columns of data so the numbers match all columns where found
    By lisagonzalez in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-24-2015, 03:10 PM
  4. Sum of numbers if 2 columns match
    By carllj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-01-2013, 08:11 PM
  5. Having columns match numbers in one column
    By Mike in forum Excel General
    Replies: 2
    Last Post: 02-09-2006, 11:50 PM
  6. [SOLVED] how can I match numbers from two columns?
    By Lea in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-26-2005, 05:05 AM
  7. How can I match numbers from two columns?
    By Lea in forum Excel General
    Replies: 2
    Last Post: 09-26-2005, 04:05 AM

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