+ Reply to Thread
Results 1 to 6 of 6

Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

  1. #1
    Registered User
    Join Date
    05-28-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2007
    Posts
    86

    Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

    In the attached example an insurance company is recording claims.
    Each Claim Number can only be recorded once in the list.
    Multiple Vehicles may be involved in one claim. It is important to highlight if this is the case.
    Multiple Incident Types may be attributed to one vehicle. E.g. stolen then recovered. It is important to highlight if the recovery company has recovered the vehicle.

    My main difficulty I have is that the data is recorded under a unique reference meaning that when there is more than one condition, they cannot be accurately recorded in the same row. My solution is to create a new column highlighting the important points.

    My question is two fold:
    Is there a known way to overcome the one to many nature of this table design in Excel?
    If no other solution is available, what sort of formulas would I need to highlight the desired values described in the example?

    Many thanks.
    Attached Files Attached Files
    Last edited by Knawl; 09-29-2014 at 06:38 AM. Reason: Attachment wrong

  2. #2
    Registered User
    Join Date
    05-28-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

    Due to the number of views, but zero opening of the attachment - I would just like to add that the data is just a convenient example and not actually for an insurance company!

    Have I worded my post badly? I don't think these are particuarly difficult formulas...

  3. #3
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

    Hi,

    in G2

    =COUNTIF(Vehicles!$B$2:$B$24,A2)


    In H2

    =IF(C2="Recovered","yes","")

    in I2

    =IF(AND(B2="Home Address",C2="Stolen"),"Yes","")


    Hope it helps
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  4. #4
    Registered User
    Join Date
    05-28-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

    Thanks canapone,

    However the fact that there are multiple Vehicles and Incident Types make this a little more involved than the formulas recommended. The formulas must work off the data in the Vehicles! sheet.

    =COUNTIF(Vehicles!$B$2:$B$24,A2)
    This does not take into consideration the the same vehicle can appear twice, therefore appearing as "2" when there was only one car.

    =IF(C2="Recovered","yes","")
    There can be multiple vehicles and incident types, so this only accounts for vehicles picked up in INDEX MATCH formula - not necessarily picking up the recovered vehicle.

    =IF(AND(B2="Home Address",C2="Stolen"),"Yes","")
    Same as limitation above.

  5. #5
    Registered User
    Join Date
    05-28-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

    Ok this:
    =IF(D2="","",SUMPRODUCT((Vehicles!$B$2:$B$24=$A2)*(Vehicles!$C$2:$C$24<>$D2))+1)
    works instead of this:
    =COUNTIF(Vehicles!$B$2:$B$24,A2)

    Still looking at the others.
    Last edited by Knawl; 09-29-2014 at 10:05 AM.

  6. #6
    Registered User
    Join Date
    05-28-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Count Multiple Values in Sheet2 based on Unique Reference in Sheet1

    This:
    =IF(SUMPRODUCT((Vehicles!$A$2:$A$24 = "Recovered")*(Vehicles!$B$2:$B$24=A2)),"Yes","")
    Works instead of this:
    =IF(C2="Recovered","yes","")


    And this:
    =IF(SUMPRODUCT((Vehicles!$A$2:$A$24 = "Stolen")*(B2="Home Address")*(Vehicles!$B$2:$B$24=A2)),"Yes","")
    Works instead of this:
    =IF(AND(B2="Home Address",C2="Stolen"),"Yes","")

    Phew, all afternoon but got there.

+ 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] copy data from sheet1 to sheet2 based on column (A) sheet1 and column (C) sheet2
    By AWITCHER in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-13-2014, 03:20 PM
  2. Replies: 3
    Last Post: 06-06-2012, 05:36 AM
  3. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 AM
  4. Help! Hiding rows in sheet2 based on values in sheet1
    By Oti in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2011, 12:47 PM
  5. Macro to copy values from Sheet1 to Sheet3, based on criteria in Sheet2
    By John74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2010, 04:55 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