+ Reply to Thread
Results 1 to 6 of 6

Return first non-blank value in duplicate data

  1. #1
    Registered User
    Join Date
    07-31-2017
    Location
    Michigan
    MS-Off Ver
    2016
    Posts
    23

    Return first non-blank value in duplicate data

    I have a list of duplicate cases (column A). Both duplicates have information that the other may or may not have. I would like to use INDEX MATCH to match the case number and return the first non empty value corresponding to the attribute in the event that the other duplicate is empty. I assume I would need to use a two-way INDEX MATCH.

    Original data
    Case Attribute1 Attribute2 Attribute3 Attribute4 Attribute5
    1 36 (blank) 3 AO 3
    1 (blank) apple 3 AO (blank)
    2 (blank) orange (blank) (blank) 85
    2 61 (blank) 3 AD (blank)
    3 54 orange (blank) BL 40
    3 (blank) (blank) 4 (blank) (blank)

    Output I am looking for
    Case Attribute1 Attribute2 Attribute3 Attribute4 Attribute5
    1 36 apple 3 AO 3
    2 61 orange 3 AD 85
    3 54 orange 4 BL 40

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Return first non-blank value in duplicate data

    With your data in A1:F7 and your output in H1:M4 (headers in row 1), try this in I2:

    =INDEX(B$2:B$7,INDEX(MATCH(1,($A$2:$A$7=$H2)*(B$2:B$7<>""),0),0))

    Drag the formula through M2 and then down through row 4.

    If you need help getting the Unique case numbers in column H, let us know.

  3. #3
    Registered User
    Join Date
    07-31-2017
    Location
    Michigan
    MS-Off Ver
    2016
    Posts
    23

    Re: Return first non-blank value in duplicate data

    Thank you, very helpful. Is it possible (with formula) to carry over the cell color as well? Or would I need VBA for this? I don't know VBA.

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Return first non-blank value in duplicate data

    Not unless the colored cells are filled through Conditional Formatting or there is some underlying logic as to why the cells are colored how they are.

    If there is some sort of logic behind what should be colored, you may be able to build a Conditional Formatting formula to fill the output cells.

  5. #5
    Registered User
    Join Date
    07-31-2017
    Location
    Michigan
    MS-Off Ver
    2016
    Posts
    23

    Re: Return first non-blank value in duplicate data

    That' what I thought, thanks. Last question, is there VBA code that can do both of these, merge the duplicate data ignoring using first non-blank cells, and carrying over the format of the cell already in place?

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Return first non-blank value in duplicate data

    Probably, but I don't know VBA.

+ 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] If two cells are blank then return blank, else vlookup cell with populated data
    By Jason G in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-06-2017, 10:20 AM
  2. Replies: 1
    Last Post: 07-22-2016, 04:03 PM
  3. [SOLVED] Cells in a range are all not blank, return maximum value (date), If 1 blank return 0
    By Matt1998 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2016, 11:14 AM
  4. Return values with duplicate referenced data
    By tantcu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-08-2015, 06:57 PM
  5. [SOLVED] Need to Duplicate Data After Adding a Blank Row
    By ashleyjean in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-21-2013, 12:58 PM
  6. Return and non-duplicate SUMIF data
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-22-2012, 08:19 AM
  7. Duplicate data from field above if cell is blank
    By ollierice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2011, 05:16 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