+ Reply to Thread
Results 1 to 17 of 17

Formula for matching multi-value sets with database

  1. #1
    Registered User
    Join Date
    04-08-2020
    Location
    London, UK
    MS-Off Ver
    Office 2019 (Mac)
    Posts
    14

    Formula for matching multi-value sets with database

    Hi all,

    Long-time visitor, first-time poster.

    I have a database of cases. Each case has been tested twice, and each test contains 5 scores (9-point scale).

    I want to be able to manually enter scores for new cases (E:G 2:6 in attachment), and use a formula which feeds back which case/s - if any - have matching values (G8 in attachment).

    I'm not sure if this is achievable, but any tips or suggestions on workarounds would be appreciated!

    Thanks in advance
    Attached Files Attached Files
    Last edited by 6StringJazzer; 04-08-2020 at 09:54 AM. Reason: Moved from For Other Platforms(Mac, Google Docs, Mobile OS etc) because it is not specific to the Mac platform

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula for matching multi-value sets with database

    If you want to avoid code then given your version (Mac 2019) it would be simplest to create keys c/o TEXTJOIN etc... e.g.:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    you can then, for ex., create an additional case with identical values to Case 2, and you should find G8 updates to pick up both Case 2 and the new Case.

  3. #3
    Registered User
    Join Date
    04-08-2020
    Location
    London, UK
    MS-Off Ver
    Office 2019 (Mac)
    Posts
    14

    Re: Formula for matching multi-value sets with database

    Wow. Thank you so much for this, this is exactly the kind of thing I wanted!! Blown away by the level of knowledge here!!

    Thanks again

  4. #4
    Registered User
    Join Date
    04-08-2020
    Location
    London, UK
    MS-Off Ver
    Office 2019 (Mac)
    Posts
    14

    Re: Formula for matching multi-value sets with database

    One more quick question if you don't mind...

    Would it be possible to have a range of values in one of the Score cells, and have a positive return if any of the values in the New Case cells match?

    I've attached a new spreadsheet. The value in B9 should ideally be a range between 5-7.

    Thanks in advance!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-05-2020
    Location
    Hannover, Germany
    MS-Off Ver
    MS Office 365
    Posts
    15

    Re: Formula for matching multi-value sets with database

    Sorry, I tried the second formula (for G8) and it doesn't work...

    Should it be something wrong with my operation or is this formula missing something?..

    Thanks in advance for answering my confusion!

  6. #6
    Registered User
    Join Date
    04-08-2020
    Location
    London, UK
    MS-Off Ver
    Office 2019 (Mac)
    Posts
    14

    Re: Formula for matching multi-value sets with database

    Thanks for taking a look! The second formula won't work as I have put a placeholder value in B9 ("5,6,7"). If you change this value to "7" it should work.

    Hope this makes sense!

  7. #7
    Registered User
    Join Date
    04-05-2020
    Location
    Hannover, Germany
    MS-Off Ver
    MS Office 365
    Posts
    15

    Re: Formula for matching multi-value sets with database

    Sorry but it still doesn't work... and the value in B9 seems already 7..

    Please see the file attached if you are willing to help me out here..

    Thanks!
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-08-2020
    Location
    London, UK
    MS-Off Ver
    Office 2019 (Mac)
    Posts
    14

    Re: Formula for matching multi-value sets with database

    Ah, I think we're looking at different spreadsheets. If you look at the spreadsheet attached below ('Case Database 3') you can see the formula working.
    Attached Files Attached Files

  9. #9
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula for matching multi-value sets with database

    Quote Originally Posted by mike6732 View Post
    One more quick question if you don't mind...

    Would it be possible to have a range of values in one of the Score cells, and have a positive return if any of the values in the New Case cells match?
    you could try modifying as follows:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by XLent; 04-10-2020 at 07:44 AM. Reason: typo in narrative - no changes to formulae

  10. #10
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula for matching multi-value sets with database

    Quote Originally Posted by forester_xb View Post
    Sorry but it still doesn't work... and the value in B9 seems already 7..

    Please see the file attached if you are willing to help me out here.
    @forester_xb

    FYI - in your sample attachment the formula in Col D is incorrect
    1. should be in D1 rather than D2
    2. reference to B2:C6 should be relative rather than fixed ($B$2:$C$6) - as a result the key value in D9 is not correct.

    if you fix the above, and copy down the value will generate as expected in G8.

    Note: TEXTJOIN is not available in XL2016 (per your profile).
    Last edited by XLent; 04-09-2020 at 10:05 AM. Reason: edit: missed formula also put in wrong cell

  11. #11
    Registered User
    Join Date
    04-08-2020
    Location
    London, UK
    MS-Off Ver
    Office 2019 (Mac)
    Posts
    14

    Re: Formula for matching multi-value sets with database

    Incredible, works perfectly! Thank you so so much!

  12. #12
    Registered User
    Join Date
    04-05-2020
    Location
    Hannover, Germany
    MS-Off Ver
    MS Office 365
    Posts
    15

    Re: Formula for matching multi-value sets with database

    Hi,

    thanks a lot for the reply! With the file you offered I found out that I wrongly put the first formula in D2, which is the main reason behind! And the rest is solved by Xlent's explanation!

    Thanks!

  13. #13
    Registered User
    Join Date
    04-05-2020
    Location
    Hannover, Germany
    MS-Off Ver
    MS Office 365
    Posts
    15

    Re: Formula for matching multi-value sets with database

    Hi,

    thanks a lot for the information!

    It works now actually, and I'm using Excel 365 so I think it is updated to latest version maybe.
    Just really curious about the usage of REPT() here, it outputs an array consisting of "" and "Case 2", which is not the normal case explained by the REPT function-Office Support website..

  14. #14
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula for matching multi-value sets with database

    the REPT is being used as

    REPT(range,boolean array)

    the individual Booleans will only be True if the key has been found -- and in native XL True = 1 and False = 0

    so, where the Boolean test returns FALSE we will get a null string as "apple" repeated 0 times = ""

    we then use the outer TEXTJOIN to collate the individual results (the outer INDEX is used simply to negate requirement for Array Entry}.

    the complex piece, in this particular thread, is establishing the boolean results, i.e.:

    ISNUMBER(SEARCH(TEXTJOIN("^",,INDEX("R"&{1;2;3;4;5}&"C"&{1,2}&"@*,"&$F$2:$G$6&",*",0)),$D$1:$D$13))

    the above basically creates an array of values, R1C1 to R5C2 {with each RxCy representing an element in the 5x2 matrix) to which we append item values

    by prefixing & suffixing the values with wildcard & comma (*,x,*) we can then search for the current matrix in the others, and thus handle possibility of delimited ranges in prior cases
    (e.g. 5,6,7 for one individual element)

    HTH

  15. #15
    Registered User
    Join Date
    04-05-2020
    Location
    Hannover, Germany
    MS-Off Ver
    MS Office 365
    Posts
    15

    Re: Formula for matching multi-value sets with database

    Hi XLent,

    BIG thanks for the greatly detailed explanation, with which I now eventually understand how this formula works, especially the REPT()!
    One important takeaway is that, REPT(text, num_times) will repeat the text with specified times and finally output a text string, while REPT(range, num_times) will repeat each text in the range with corresponding number of times and finally output an array of strings.

    Hope my understanding is correct and thank you very much again!

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: Formula for matching multi-value sets with database

    It works now actually, and I'm using Excel 365 ...
    Then please update your user profile!

    In future, if you have queries pertaining to someone else's thread, you should start your own with your query and a link back to the thread in question. I hope this is clear.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  17. #17
    Registered User
    Join Date
    04-05-2020
    Location
    Hannover, Germany
    MS-Off Ver
    MS Office 365
    Posts
    15

    Re: Formula for matching multi-value sets with database

    Hi,
    thanks for reminding.
    Have updated my profile and will do so in future.

    BR

+ 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. Matching Two Sets of Data
    By Matt Brash in forum Excel General
    Replies: 2
    Last Post: 09-26-2016, 06:59 AM
  2. Formula needed for looking up matching text in separate data sets
    By computer1234 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-23-2014, 06:48 PM
  3. Matching Sets of Data
    By omaribookal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2014, 02:23 PM
  4. [SOLVED] Formula to match data ( multi column) in different sheets and return matching values
    By kangyao in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-17-2013, 08:49 PM
  5. [SOLVED] Formula to match data in different sheets ( multi column) and return matching values
    By kangyao in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-11-2013, 07:38 PM
  6. Matching two data sets
    By sbarnhar in forum Excel General
    Replies: 8
    Last Post: 11-03-2009, 12:31 PM
  7. Matching two sets of Data
    By ikflash in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-18-2008, 03:32 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