+ Reply to Thread
Results 1 to 19 of 19

VLOOKUP to pull in duplicate values

  1. #1
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    VLOOKUP to pull in duplicate values

    Good day,

    Currently I have a formula to pull in fees from a different TAB but now and then I run across the issue when there are duplicate values :

    Main formula on first sheet :

    =IF($A2="","",VLOOKUP($C2,'LenderDailyBilling-MAML (6)'!$A$4:$O$31,15,0)*$D2)

    The tab where the data is being pulled from :

    So in this instance I have 2 x GFI rows which values i need and it simply ignores the second, how can i amend my formula to have both pulled in?

    Ticker Id
    -----------------------------------
    SNH
    GFI
    GFI

    ANG
    BTI
    VOD
    PSG
    TKG


    Regards
    Attached Files Attached Files
    Last edited by Aredeekay; 11-04-2019 at 06:02 AM.

  2. #2
    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,770

    Re: VLOOKUP to pull in duplicate values

    You cannot do what you want with VLOOKUP, which returns ONLY the first match.

    Look at the yellow banner up top to find out how to attach your sample workbook - don't forget to manually mock-up your expected results.
    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.

  3. #3
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    Thank you - file attached.

    Would you suggest a different formula/approach achieve the desired result?

  4. #4
    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,770

    Re: VLOOKUP to pull in duplicate values

    Well, I guess so - did you read what I said?

    I am going to have a look now.

  5. #5
    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,770

    Re: VLOOKUP to pull in duplicate values

    OK - the problem you have in the lookup sheet is that there is nothing that distinguishes the first GFI entry from the second - how is Excel meant to know which one to use for each line in the results column? What is the logic? Is it just a case of the next one down?

  6. #6
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    Yes it's essentially the next one down. All the values from the LenderDailyBilling tab needs to be used and split accordingly

  7. #7
    Registered User
    Join Date
    12-03-2012
    Location
    CHENNAI , INDIA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: VLOOKUP to pull in duplicate values

    Hi ,

    See if this works.

    The formula in cell G3 is :

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is an array formula to be entered using CTRL SHIFT ENTER.

    See the attached file.

    Narayan
    Attached Files Attached Files

  8. #8
    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,770

    Re: VLOOKUP to pull in duplicate values

    OK - so two questions:

    1. Are the result and lookup datasets in the same order? If not, then we shall need a different approach.
    2. What happens if there are 3 GFIs (or any other ID) in the results set, but only 2 in the lookup set?

  9. #9
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    This seems to pull in the duplicates but returns the incorrect values

  10. #10
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    1. It's in a different order.
    2. The lookup & result set will always have the same amount of values, it needs to match.

    To give a short summary, the lookup set has the Fees & portfolios %'s whereas the result set takes the fees and splits them according to the portfolio %

  11. #11
    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,770

    Re: VLOOKUP to pull in duplicate values

    OK - thanks for clarifying.

  12. #12
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    Anyone perhaps have a solution for this?

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP to pull in duplicate values

    I am a little confused. Pulling back two values for GFI is easy.... and I understand why. But. Why are you expecting two results for ANG, when there is only one entry for ANG on "LenderDailyBilling-MAML (6)"
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  14. #14
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23
    It changes every day, for example on this day there was only 1 duplicate, the 2 GFI'S, but the next could be multiple duplicates
    Last edited by AliGW; 11-05-2019 at 05:59 AM. Reason: Please don't quote unnecessarily!

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP to pull in duplicate values

    So.... do you want a blank for the second ANG... or only to get the correct number of ANGs on each day?

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP to pull in duplicate values

    Take alook:

    =IFERROR(INDEX('LenderDailyBilling-MAML (6)'!O:O,AGGREGATE(15,6,ROW('LenderDailyBilling-MAML (6)'!$O$4:$O$100)/('LenderDailyBilling-MAML (6)'!$A$4:$A$100=C3),COUNTIF($C$3:C3,C3)))*$D3,"")


    If this is incorrect, what do you expect to see.... and why?
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    Quote Originally Posted by Glenn Kennedy View Post
    Take alook:

    =IFERROR(INDEX('LenderDailyBilling-MAML (6)'!O:O,AGGREGATE(15,6,ROW('LenderDailyBilling-MAML (6)'!$O$4:$O$100)/('LenderDailyBilling-MAML (6)'!$A$4:$A$100=C3),COUNTIF($C$3:C3,C3)))*$D3,"")


    If this is incorrect, what do you expect to see.... and why?
    Hi Glenn,

    I think i had to go a bit more in detail on what the sheet does exactly and the expected results that I'm looking for :

    To summarize :

    On the first sheet the formulas pull in the fees for each stock as per the 2nd sheet(LenderDailyBilling-MAML) and splits them according to the portfolio %'s as per the 3rd sheet(SecLendingDetail)

    For example :

    R100 in fees for ANG , ANG is split into 2 portfolios(39% to to and 61% for the other) and then split the fees 39$ to 1 and 61$ to the other according to the % split.

    In this instance GFI appears twice on the fee sheet, and needs to be split twice, whereas my original formula only takes the first line of GFI and splits it accordingly, I'm looking for a way to amend the formula to take each GFI(or whichever stock it will be on the given day) and split each of them.

    For example on the 2nd sheet GFI has 2 values : 103.23 & 28.74

    According to the 3rd sheet GFI is split into 2 portfolios - MMITED 36% & MMISXD 64%

    Now the current formula only takes the first GFI value of 103.23 and splits it between the portfolios but ignores the 2nd value(28.74)

    Apologies for the confusion

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: VLOOKUP to pull in duplicate values

    Now I understand!!

    =IF($A3="","",SUMIF('LenderDailyBilling-MAML (6)'!A:A,'Fee split Managed per day'!C3,'LenderDailyBilling-MAML (6)'!O:O)*$D3)

  19. #19
    Registered User
    Join Date
    04-22-2016
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    23

    Re: VLOOKUP to pull in duplicate values

    Quote Originally Posted by Glenn Kennedy View Post
    Now I understand!!

    =IF($A3="","",SUMIF('LenderDailyBilling-MAML (6)'!A:A,'Fee split Managed per day'!C3,'LenderDailyBilling-MAML (6)'!O:O)*$D3)
    Thank you so much! This works.

+ 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] Vlookup to pull values from 3 worksheets.
    By kreiner2006 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-05-2019, 02:10 PM
  2. [SOLVED] Array to pull duplicate values from a different sheet
    By Rachel5694 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-08-2018, 03:45 PM
  3. Pull duplicate values into list
    By JDobbsy1987 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-02-2017, 05:39 PM
  4. Replies: 1
    Last Post: 04-20-2015, 03:18 PM
  5. Use vlookup or formula to pull multiple values
    By jcavigli in forum Excel General
    Replies: 3
    Last Post: 02-06-2013, 03:18 PM
  6. Pull out duplicate values
    By john_prince in forum Excel General
    Replies: 15
    Last Post: 03-26-2010, 11:41 AM
  7. How to pull the duplicate values from 2 columns?
    By DianaPur in forum Excel General
    Replies: 9
    Last Post: 06-01-2009, 02:59 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