+ Reply to Thread
Results 1 to 10 of 10

I need to compare two columns and see if any row has two specified values adjacent

  1. #1
    Registered User
    Join Date
    11-27-2016
    Location
    America
    MS-Off Ver
    2016
    Posts
    8

    I need to compare two columns and see if any row has two specified values adjacent

    I'm working on a spreadsheet that determines the total resistance of any complex circuit. I am trying to figure out a way to determine what row has two specified values within two columns. For example, Two columns have numbers 0-3. Each number shows up 3 times within the two columns matching up with each of the other numbers once. (See Column C and D "Node 1", "Node 2"). Next to those columns is a column for current.

    On the lower portion of the spreadsheet is a table in red with numbers going vertically and horizontally. I want to know the value of the current where the vertical and horizontal numbers match up. For example.

    0-0 would read NA
    0-1 would read 0.055555556
    0-2 would read 0.019736842

    And so on.

    P.S. Theoretically I will be adding something that will make the current negative or positive according to which voltage is higher, but I can figure that out on my own. I need help with the first part.

    Thanks!

  2. #2
    Registered User
    Join Date
    11-27-2016
    Location
    America
    MS-Off Ver
    2016
    Posts
    8

    Re: I need to compare two columns and see if any row has two specified values adjacent

    I thought I posted the spreadsheet, sorry. Hopefully this works now
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: I need to compare two columns and see if any row has two specified values adjacent

    Hello
    Take a look at the attached reply. Does this do as required? I've created three named ranges to make it clearer and used an array formula, these are entered with Ctrl+Shift+Enter. The formulas match Node 2 to Node 1 for the values 0-3.

    DBY
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: I need to compare two columns and see if any row has two specified values adjacent

    Not sure I follow you. But try this array formula in J12, copied across and down:

    =IFERROR(INDEX($E$2:$E$7,MATCH(1,($D$2:$D$7=$I12)*($C$2:$C$7=J$11),0)),INDEX($E$2:$E$7,MATCH(1,($C$2:$C$7=$I12)*($D$2:$D$7=J$11),0)))

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: I need to compare two columns and see if any row has two specified values adjacent

    DBY, two very different answers....

    Sirbenjis, in the even that we're both wrong, please show your expected results IN DETAIL.... as "and so on" wasn't enough for me to understand!!!

  6. #6
    Registered User
    Join Date
    11-27-2016
    Location
    America
    MS-Off Ver
    2016
    Posts
    8

    Re: I need to compare two columns and see if any row has two specified values adjacent

    @DBY

    Yes, perfect! Any suggestions on how to get the rest of the values since the nodes in the columns vary in sides. For example, 0 never shows up on the left side.

    I do not want to put any critical guidelines regarding how the nodes are input. I'd like excel to read any possible input.

    Thanks so much

  7. #7
    Registered User
    Join Date
    11-27-2016
    Location
    America
    MS-Off Ver
    2016
    Posts
    8

    Re: I need to compare two columns and see if any row has two specified values adjacent

    Glenn, that looks right as well! I simply need the values in that table so I can extract information from it! Thank you very much!

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

    Re: I need to compare two columns and see if any row has two specified values adjacent

    In J12

    =IFERROR(INDEX($E$2:$E$7,MATCH(1,($I12=$C$2:$C$7)*(J$11=$D$2:$D$7),0)),IFERROR(INDEX($E$2:$E$7,MATCH(1,($I12=$D$2:$D$7)*(J$11=$C$2:$C$7),0)),""))

    Enter with Ctrl+Shift+Enter

    Copy across and down

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: I need to compare two columns and see if any row has two specified values adjacent

    How can they both be right, when one had 4 #N/A values and the other had 10????

  10. #10
    Registered User
    Join Date
    11-27-2016
    Location
    America
    MS-Off Ver
    2016
    Posts
    8

    Re: I need to compare two columns and see if any row has two specified values adjacent

    They both have the idea I was looking for with different approaches. Yours suited my needs best.

+ 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. Compare values in adjacent columns, replace if identical
    By dannyjoer in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-27-2014, 10:59 AM
  2. Replies: 3
    Last Post: 02-15-2012, 01:18 AM
  3. Compare values in two columns and return text from adjacent cell
    By MrBorders in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-04-2009, 04:54 AM
  4. compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  5. [SOLVED] compare contents of two adjacent columns
    By Gary's Student in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 02:05 PM
  6. compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  7. [SOLVED] compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  8. [SOLVED] compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-08-2005, 05: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