+ Reply to Thread
Results 1 to 4 of 4

Doing a look up on a cell with comma separated values

  1. #1
    Registered User
    Join Date
    05-10-2017
    Location
    Morocco
    MS-Off Ver
    2012
    Posts
    1

    Doing a look up on a cell with comma separated values

    Hello,

    I would like to take a comma separated list of entities in a single cell, do a lookup of their corresponding scores on a separate table, and then average the scores that are returned for each entity.

    Example:

    Cell 1A, Sheet 1: United States, Canada, India (all in one cell)

    Table 2, Sheet 2, columns A and B:
    United States- 5
    Canada- 6
    United Kingdom- 10
    Egypt- 3
    Lebanon- 2
    India- 7

    So I'd want cell 2A in Sheet1 to populate with 6, the average of 5,6,7. Is there any way this can be done? I don't want to do text to columns here. Any other solution?

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Doing a look up on a cell with comma separated values

    =AVERAGE(IF(ISNUMBER(FIND(A1:A6,F1)),B1:B6)) as array formula
    Attached Files Attached Files

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Doing a look up on a cell with comma separated values

    Hi,

    Array formula**

    =AVERAGE(IF(ISNUMBER(SEARCH(", "&Sheet2!A1:A6&", ",", "&A1&", ")),Sheet2!B1:B6))


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Doing a look up on a cell with comma separated values

    Quote Originally Posted by tim201110 View Post
    =AVERAGE(IF(ISNUMBER(FIND(A1:A6,F1)),B1:B6)) as array formula
    True, it's quite unlikely that such an approach will fail, though not impossible. For example, assuming that F1 contains:

    "United States, Canada, Nigeria"

    and that the list in A1:A6 contains "Niger" amongst its entries, your formula will give incorrect results.

    Hence the reason why I included the commas in my solution.

    Regards

+ 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] Compare comma separated values in a cell to a list
    By SMB in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-03-2019, 01:10 AM
  2. [SOLVED] Using comma separated values in a single cell
    By joerobb in forum Excel General
    Replies: 7
    Last Post: 01-16-2015, 08:45 AM
  3. Function for Comma-Separated Values within Cell
    By SoothSailor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-07-2014, 06:21 PM
  4. [SOLVED] Extracting information from a comma separated list of values in one cell
    By cardiff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2012, 09:17 PM
  5. Replies: 6
    Last Post: 07-19-2012, 01:58 PM
  6. Replies: 3
    Last Post: 01-13-2012, 08:20 AM
  7. Resolved >>> Comma separated values in a cell
    By usr789 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2007, 08:36 AM

Tags for this Thread

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