+ Reply to Thread
Results 1 to 16 of 16

Testing Values Between Two Sheets (Simplified and Updated)

  1. #1
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Testing Values Between Two Sheets (Simplified and Updated)

    PLEASE SEE POST #9 FOR AN UPDATED VERSION OF MY QUESTION

    Hello,
    I need help creating formula that test the validity of values in one sheet, using rules in another. The formula would work between two sheets in the same workbook the Testing sheet and the Rules sheet. I really need 6 different formulas but with slight changes to each I really only need 3 and I figured I can do the other 3 on my own. A breakdown of the rows and columns for both sheets is below.

    Testing Sheet
    Column [A] of the Testing sheet are listed number combinations.

    Columns [B] through [L] have indicator rule headers and the rows below contain True or False values.

    Column [M] contains values that are either Win, Loss, or Break Even.

    Columns [N] through [T] is where the formula I need will reside in the rows below.

    Rules Sheet
    Columns [A] through [S] contain number combinations in the header and indicator rules or number combinations in the rows below.

    How I want all of this to work:
    1st: The formula would start by matching the number combination in the Testing sheet with the number combination header in the Rules sheet.

    2nd: The formula would return to the Testing sheet and see what value is in column [M] that corresponds with the number combination it matched.

    3rd: The formula would then go back to the Rules sheet and review whether the matching number combination column contained text or numbers and based on that result it would follow the rules outlined below.

    FORMULAS
    WIN
    1.) =MATCH(‘Testing Sheet’ A3 to ‘Rules Sheet’ [A1 – S1])
    MATCH FOUND(‘Testing Sheet’ A3 equals 1231111/222=‘Rules Sheet’ A1 equals 1231111/222)
    IF(‘Testing Sheet’ M3=Win AND ‘Rules Sheet’ A2=Text)
    AND(‘Testing Sheet’ [B3 – L3] All values are True when compared to text in ‘Rules Sheet’ [A2 – A10])
    THEN result in ‘Testing Sheet’ N3=TRUE

    2.) =MATCH(‘Testing Sheet’ A12 to ‘Rules Sheet’ [A1 – S1])
    MATCH FOUND(‘Testing Sheet’ A12 equals 1311434/323=‘Rules Sheet’ J1 equals 1311434/323)
    IF(‘Testing Sheet’ M12=Win AND ‘Rules Sheet’ J2=Number)
    THEN result in ‘Testing Sheet’ N12=Optimize

    3.) =MATCH(‘Testing Sheet’ A2 to ‘Rules Sheet’ [A1 – S1])
    MATCH FOUND(‘Testing Sheet’ A2 equals 1231111/222=‘Rules Sheet’ A1 equals 1231111/222)
    IF(‘Testing Sheet’ M2=Win AND ‘Rules Sheet’ A2=Text)
    AND(‘Testing Sheet’ [B26 – L26] 1+ values are False when compared to text in ‘Rules Sheet’ [O2 – O10])
    THEN result in ‘Testing Sheet’ N2=Review

    LOSS OR BREAK EVEN
    1.) =MATCH(‘Testing Sheet’ A14 to ‘Rules Sheet’ [A1 – S1])
    MATCH FOUND(‘Testing Sheet’ A14 equals 1311441/232 =‘Rules Sheet’ K1 equals 1311441/232)
    IF(‘Testing Sheet’ M14=Loss or Break Even AND ‘Rules Sheet’ K2=Text)
    AND(‘Testing Sheet’ [B14 – L14] 1+ values are False when compared to text in ‘Rules Sheet’ [K2 – K10])
    THEN result in ‘Testing Sheet’ N14=TRUE

    2.) =MATCH(‘Testing Sheet’ A6 to ‘Rules Sheet’ [A1 – S1])
    MATCH FOUND(‘Testing Sheet’ A6 equals 1311421/323=‘Rules Sheet’ D1 equals 1311421/323)
    IF(‘Testing Sheet’ M6=Loss or Break Even AND ‘Rules Sheet’ D2=Number)
    THEN result in ‘Testing Sheet’ N6=‘Testing Sheet’ A6

    3.) =MATCH(‘Testing Sheet’ A26 to ‘Rules Sheet’ [A1 – S1])
    MATCH FOUND(‘Testing Sheet’ A26 equals 1311444/333=‘Rules Sheet’ O1 equals 1311444/333)
    IF(‘Testing Sheet’ M26=Loss or Break Even AND ‘Rules Sheet’ O2=Text)
    AND(‘Testing Sheet’ [B26 – L26] All values are True when compared to text in ‘Rules Sheet’ [O2 – O10])
    THEN result in ‘Testing Sheet’ N26=Review

    Simplified Breakdown of All Six
    (Testing Sheet = Testing S./Result Sheet = Result S./Number Combinations = # Combo)
    Testing S./Result S. # Combo Match = Testing S. Win = Result S. Text = Testing S. All TRUE = Answer = TRUE
    Testing S./Result S. # Combo Match = Testing S. Win = Result S. Numbers = Answer = Optimize
    Testing S./Result S. # Combo Match = Testing S. Win = Result S. Text = Testing S. 1+ FALSE = Answer = Review

    Testing S./Result S. # Combo Match = Testing S. Loss or Break Even = Result S. Text = Testing S. 1+ FALSE = Answer = TRUE
    Testing S./Result S. # Combo Match = Testing S. Loss or Break Even = Result S. Numbers = Answer = Numbers
    Testing S./Result S. # Combo Match = Testing S. Loss or Break Even = Result S. Text = Testing S. All TRUE = Answer = Review


    I hope I’ve been able to explain well enough what I am looking for. I’ve attached a workbook with examples for a better understanding.


    Thank you in advance for any and all help.
    Attached Files Attached Files
    Last edited by artiststevens; 03-19-2014 at 03:51 AM.

  2. #2
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Testing Values Between Two Sheets

    Any help would be greatly appreciated.

  3. #3
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Testing Values Between Two Sheets

    Any help or advice would be greatly appreciated.

  4. #4
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Testing Values Between Two Sheets

    I really need 6 different formulas but with slight changes to each I really only need 3 and I figured I can do the other 3 on my own.

    If anyone can just help with creating a formula for one or maybe two of the formulas below I would greatly appreciate it.


    1st: The formula would start by matching the number combination in the Testing sheet with the number combination header in the Rules sheet.

    2nd: The formula would return to the Testing sheet and see what value is in column [M] that corresponds with the number combination it matched.

    3rd: The formula would then go back to the Rules sheet and review whether the matching number combination column contained text or numbers and based on that result it would follow the rules outlined below.

    WRITTEN OUT FORMULA EXAMPLES

    1.) =Find MATCH for value in ‘Testing Sheet’ A3 (1231111/222) by scanning ‘Rules Sheet’ [A1 – S1]

    MATCH would be ‘Rules Sheet’ A1 (1231111/222)

    IF ‘Testing Sheet’ M3=Win AND ‘Rules Sheet’ A2=Text (Strawberry)

    AND ‘Testing Sheet’ [B3 – L3] values are TRUE for each text heading listed in ‘Rules Sheet’ [A2 – A10]

    THEN result in ‘Testing Sheet’ N3=TRUE


    2.) =Find MATCH for value in ‘Testing Sheet’ A12 (1311434/323) by scanning ‘Rules Sheet’ [A1 – S1]

    MATCH would be ‘Rules Sheet’ J1 (1311434/323)

    IF ‘Testing Sheet’ M12=Win AND ‘Rules Sheet’ J2=Number (1311434)

    THEN result in ‘Testing Sheet’ N12=Optimize


    3.) =Find MATCH for value in ‘Testing Sheet’ A2 (1231111/222) by scanning ‘Rules Sheet’ [A1 – S1]

    MATCH would be ‘Rules Sheet’ A1 (1231111/222)

    IF ‘Testing Sheet’ M2=Win AND ‘Rules Sheet’ A2=Text (Strawberry)

    AND ‘Testing Sheet’ [B2 – L2] 1+ values are FALSE for each text heading listed in ‘Rules Sheet’ [A2 – A10]

    THEN result in ‘Testing Sheet’ N2=Review



    I hope I’ve been able to make a little clearer. Feel free to ask questions. Thank you in advance for any and all help.
    Last edited by artiststevens; 03-17-2014 at 12:27 AM.

  5. #5
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Testing Values Between Two Sheets

    I'm attaching another workbook with more information about what I'm trying to accomplish. Please take a look. Thank you.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    SEE POST #9.
    Any help or advice would be greatly appreciated.
    Last edited by artiststevens; 03-18-2014 at 08:03 PM.

  7. #7
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    SEE POST #9.
    Any help or advice would be greatly appreciated.
    Last edited by artiststevens; 03-18-2014 at 08:03 PM.

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

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    I read this thread when you first posted it, but it didn't make much sense to me. Now that you have tried to clarify your requirements in Posts #4 and #5 I'm not all that much wiser.

    I think your general approach would be a formula of the type:

    =IF(Rule1_applies,"TRUE",IF(Rule2_applies,"Optimise",IF(Rule2_applies,"Review","")))

    where the "" at the end could be expanded into 3 other nested IFs for your other 3 conditions.

    It's just that I'm not really sure how to phrase "Rule1_applies", or the others, in terms of your descriptions.

    Hope this helps.

    Pete

  9. #9
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Testing Values Between Two Sheets (Simplified and Updated)

    Hi Pete,
    The formula example that you gave is exactly the type of nested formula I need. The problem is I need to figure out the formula for the rules before they can be nested together. I keep trying to explain it better but it seems I’m making it more confusing.

    Can you give me idea of where the lack of understanding starts?

    I’m going to make another attempt at this. I decided to include everything on one spreadsheet instead of two.

    All three formulas require three things
    1st the matching of the number combination in column A with the matching of the number combination heading of A36 – S36
    2nd determining what the value is in column M heading Win/Loss/Break Even
    3rd determining what the values are in the columns below A36 – S36

    TYPE 1
    Using Row 3 as an example:
    Find the value that matches A3 between A36 – S36 the result would be A36
    Find the value of Row 3 (Win/Loss/Break Even) column which would be M3 (Win)
    Find the value of rows below A36 below which are Text (Strawberry, Banana, Grape, Orange, Peach, Lemon)
    Since M3 = Win AND the values below A36 = Text
    Then compare the matching heading text values in A37 – A42 with the values in the Row 3 headings [C3, D3, F3, G3, H3, I3]
    A37: Strawberry /C3: TRUE
    A38: Banana / D3: TRUE
    A39: Grape / F3: TRUE
    A40: Orange / G3: TRUE
    A41: Peach / H3: TRUE
    A42: Lemon / I3: TRUE
    If all of the values are TRUE then N2=TRUE

    TYPE 2
    Using Row 12 as an example:
    Find the value that matches A12 between A36 – S36 the result would be J36
    Find the value of Row 12 Win/Loss/Break Even column which would be M12 (Win)
    Find the value of rows below J36 which are numbers (1311433, 333)
    Since M12 = Win AND the values below J36 = Numbers
    Then the Result in N12=Optimize

    TYPE 3
    Using Row 2 as an example:
    Find the value that matches A2 between A36 – S36 the result would be A36
    Find the value of Row 2 (Win/Loss/Break Even) column which would be M2 (Win)
    Find the value of rows below A36 below which are Text (Strawberry, Banana, Grape, Orange, Peach, Lemon)
    Since M2 = Win AND the values below A36 = Text
    Then compare the matching heading text values in A37 – A42 with the values in the Row 3 headings [C2, D2, F2, G2, H2, I2]
    A37: Strawberry /C2: FALSE
    A38: Banana / D2: TRUE
    A39: Grape / F2: TRUE
    A40: Orange / G2: TRUE
    A41: Peach / H2: FALSE
    A42: Lemon / I2: TRUE
    If one or more of the values FALSE then N2=Review

    I hope I’ve been able to explain well enough this time. I’ve attached yet another workbook with examples for a better understanding.


    Thank you in advance for any and all help.
    Attached Files Attached Files

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

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    In each of your examples you have chosen the values in column M are "Win" - you have not described what should happen if column M is "Loss" or "Breakeven". You can have this formula (I've put it in O2 while I'm developing it so I don't overwrite your values in column N):

    =SUMPRODUCT((ISNUMBER(INDEX($A$37:$S$44,,MATCH(A2,$A$36:$S$36,0))*1))*(INDEX($A$37:$S$44,,MATCH(A2,$A$36:$S$36,0))<>""))

    and this can be copied down - it will give you zero if all the values in the rows below 36 in the column that matches the entry in column A are text, but if it returns a non-zero value then that is the number of numbers there are in that column (i.e. if zero then TEXT, if non-zero then NUMBERS). So, this could be used like this:

    =IF(long_SP_expression >0,IF(M2="Win","Optimise", ...

    but, what if M2 is not equal to "Win"? You seemed to be saying in your first post that this situation would return the value of column A, but since that post you have had two updates (and they are all very long so I've not read them thoroughly).

    Hope you can clarify this matter quickly (before I go to bed).

    Pete

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

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    Well, this is very close, but doesn't quite agree with your values in column N. Put this in O2:

    =IF(SUMPRODUCT((ISNUMBER(INDEX($A$37:$S$44,,MATCH(A2,$A$36:$S$36,0))*1))*(INDEX($A$37:$S$44,,MATCH(A2,$A$36:$S$36,0))<>""))>0,IF(M2="Win","Optimise",A2),IF(SUMPRODUCT(--(INDEX($B2:$L2,MATCH(INDEX($A$37:$S$44,ROW(A$37:A$44)-36,MATCH(A2,$A$36:$S$36)),$B$1:$L$1,0))))=1,"TRUE","Review"))

    then copy down.

    I'm too tired to do any more on it at the moment.

    Pete

  12. #12
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Testing Values Between Two Sheets (Simplified and Updated)

    First let me say thank you for helping me with this Pete. Now the reason I only focused on the Win was because the Loss/Break Even are similar, so I figured I would attempt to do those on my own. But the rules for the Loss/Break Even are below.

    Question so the formula that returns either zero or a number it matches the headings the number combinations as well correct? It looks like it does.

    LOSS or BREAK EVEN RULES
    Using Row 14 as an example:
    Find the value that matches A14 between A36 – S36 the result would be K36
    Find the value of Row 14 (Win/Loss/Break Even) column which would be M14 (Loss)
    Find the value of rows below K36 below which are Text (Pear, Grape, Orange, Lemon, Plum, Apricot)
    Since M14 = Loss AND the values below K36 = Text
    Then compare the matching heading text values in K37 – K42 with the values in the Row 14 headings [E14, F14, G14, I14, K14, L14]
    K37: Pear /E14: TRUE
    K38: Grape / F14: TRUE
    K39: Orange / G14: FALSE
    K40: Lemon / I14: FALSE
    K41: Plum / K14: FALSE
    K42: Apricot / L14: FALSE
    If one or more of the values are FALSE then N14=TRUE

    Using Row 6 as an example:
    Find the value that matches A6 between A36 – S36 the result would be D36
    Find the value of Row 6 Win/Loss/Break Even column which would be M6 (Loss)
    Find the value of rows below D36 which are numbers (1311421/323)
    Since M6 = Loss AND the values below D36 = Numbers
    Then the Result in N6=A6 which is (1311421/323)

    Using Row 26 as an example:
    Find the value that matches A26 between A36 – S36 the result would be O36
    Find the value of Row 26 (Win/Loss/Break Even) column which would be M26 (Loss)
    Find the value of rows below O36 below which are Text (Banana, Pear, Grape, Orange, Peach, Lemon, Plum, Apricot)
    Since M26 = Loss AND the values below O36 = Text
    Then compare the matching heading text values in O37 – A44 with the values in the Row 26 headings [D26, E26, F26, G26, H26, I26, K26, L26]
    O37: Banana / D26: TRUE
    O38: Pear / E26: TRUE
    O39: Grape / F26: TRUE
    O40: Orange / G26: TRUE
    O41: Peach / H26: FALSE
    O42: Lemon / I26: TRUE
    O43: Plum / K26: TRUE
    O44: Apricot / L26: TRUE
    If all of the values are TRUE then N26=Review

    I’m attaching another spreadsheet with the Loss or Break Even rules as well. Thank you again Pete I really appreciate it.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    Quote Originally Posted by Pete_UK View Post
    Well, this is very close, but doesn't quite agree with your values in column N. Put this in O2:

    =IF(SUMPRODUCT((ISNUMBER(INDEX($A$37:$S$44,,MATCH(A2,$A$36:$S$36,0))*1))*(INDEX($A$37:$S$44,,MATCH(A2,$A$36:$S$36,0))<>""))>0,IF(M2="Win","Optimise",A2),IF(SUMPRODUCT(--(INDEX($B2:$L2,MATCH(INDEX($A$37:$S$44,ROW(A$37:A$44)-36,MATCH(A2,$A$36:$S$36)),$B$1:$L$1,0))))=1,"TRUE","Review"))

    then copy down.

    I'm too tired to do any more on it at the moment.

    Pete
    Thank you very much Pete. I'll test it out. I understand completely. Good night.

  14. #14
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    I try to translate your idea like this:
    Please Login or Register  to view this content.
    Firstly, I make connection from A2 (testing) to range A2:A10 (Rules):
    =OFFSET('Rules Sheet'!$A$2:$A$10,,MATCH('Testing Sheet'!$A2,'Rules Sheet'!$A$1:$S$1,0)-1)
    and named it "Rule" (Ctrl-F3 to create)
    to establist range:{"Strawberry";"Banana";"Grape";"Orange";"Peach";"Lemon";0;0;0}

    Secondly, I define if "Rule" is number or not: SUM(Rule)>0 (If yes, number, else text)

    Next, I'd like to find if the "Rule" is "All True", or not (there is at least one "FALSE"):
    IF($B2:$L2=FALSE,$B$1:$L$1,"")=>{"","Strawberry","","Pear","","","Peach","","","",""} with the fruit is FALSE

    then matching FALSE: MATCH(IF($B2:$L2=FALSE,$B$1:$L$1,""),rule,0)=>{#N/A,1,#N/A,#N/A,#N/A,#N/A,
    5,#N/A,#N/A,#N/A,#N/A}

    then counting FALSE = COUNT(MATCH(IF($B2:$L2=FALSE,$B$1:$L$1,""),rule,0))=2

    Generic formula should be:
    =IF(M2="Win",IF(Number,"Optimize",IF(AllTrue,"TRUE","Review")),IF(Number,$A2,IF(AlTrue,"Review","TRUE")))

    And final formula is:
    Please Login or Register  to view this content.
    Hope it works and clear for you!
    Attached Files Attached Files
    Last edited by bebo021999; 03-18-2014 at 11:49 PM.
    Quang PT

  15. #15
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    It took a few days, a lot of updated spreadsheets, and a lot of explaining but I finally got the result I wanted. Thank you very much Pete! Thank you very much Quang! I greatly appreciate all of the hard work and effort you both put in for me to find my desired solution. I can't begin to thank you enough. It is GREATLY appreciated!

  16. #16
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Testing Values Between Two Sheets (Simplified and Updated)

    Nice to hear it works and thx 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. Automatically testing values...
    By Cheshire in forum Excel General
    Replies: 6
    Last Post: 08-22-2009, 11:08 AM
  2. Replies: 0
    Last Post: 03-08-2007, 12:04 AM
  3. Testing Range from other Sheets
    By Steven in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2006, 02:15 PM
  4. Testing Values of Cells
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-20-2005, 04: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