+ Reply to Thread
Results 1 to 7 of 7

Pls help me find the right formula for this complicated worksheet.

  1. #1
    Registered User
    Join Date
    08-03-2017
    Location
    Manila, Philippines
    MS-Off Ver
    Office 365
    Posts
    14

    Pls help me find the right formula for this complicated worksheet.

    Hi Everyone

    Can anyone pls help me find the right formula for the results I want in the following photo? I'm getting lots of errors, so I'd be appreciated if someone can help me. The results I want are highlighted. The details are as follows.

    Untitled.png

    I'd like to calculate percentage of the amount based on the rank of the staff that are being reported to. So first of all, we have to check if one staff ("A") in result table are reporting to another staff ("B") in lookup table 1. If yes, then we'll continue to check the rank of "B" in the same table. Next, based on the rank of "B", we'll check % in lookup table 2, and calculate the amount in 1st column (Column H). For example, if the rank of "B" is BB, then 10% of AMT (column G) will be shown in "1ST" column. For the "2nd" Column, we'll have to check if "B" are reporting to another staff. If yes, we'll repeat the same process. If not, then we'll stop calculating.

    Kindly see the results of ID A00007.
    A00007 is reporting to A00011 whose the rank is BB. For BB rank, the percentage is 10%, so the correct amount is $1,000.00 in 1st column. And we see that A00011 is reporting to A00009 whose the rank is CC. So we have to continue calculating the percentage in 2nd column. CC rank gets 15%, so it's $1,500.00. A00009 also reports to another staff which ID code is A00004 and the rank is DD. So 20% of $10,000.00 will be filled in 3rd column.
    I want to stop the process of calculating once a staff doesn't report to another one.

    I've tried many formula. But I can't seem to get them right. Pls help me. Thanks.
    Attached Files Attached Files
    Last edited by franceslin; 09-12-2021 at 09:50 AM. Reason: To add sample worksheet

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Pls help me find the right formula for this complicated worksheet.

    Pl read yellow banner on top of this page.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Registered User
    Join Date
    08-03-2017
    Location
    Manila, Philippines
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Pls help me find the right formula for this complicated worksheet.

    Thank you. I didn't notice it because I was preoccupied with looking for the right formula.
    I just attached my sample workbook.

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Pls help me find the right formula for this complicated worksheet.

    Please try at H3

    =IFERROR($G3*INDEX($B$9:$B$11,MATCH(VLOOKUP(VLOOKUP($F3,$A$3:$C$6,3,0),$A$3:$C$6,2,0),$A$9:$A$11,)+COLUMNS($H3:H3)-1),0)
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-03-2017
    Location
    Manila, Philippines
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Pls help me find the right formula for this complicated worksheet.

    Quote Originally Posted by Bo_Ry View Post
    Please try at H3

    =IFERROR($G3*INDEX($B$9:$B$11,MATCH(VLOOKUP(VLOOKUP($F3,$A$3:$C$6,3,0),$A$3:$C$6,2,0),$A$9:$A$11,)+COLUMNS($H3:H3)-1),0)

    Hello! Will you pls look at the attachment again?
    I've added another sheet and wrote the calculated results I wanted manually.
    I think I need to change the formula a little bit.
    Because one staff won't report to the same staff all the time.
    They'll report to another staff with different ranks.
    In the first formula you provided, the first ID didn't show the results I needed.
    Kindly check it for me again.
    Thank you very much!
    Attached Files Attached Files

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Pls help me find the right formula for this complicated worksheet.

    H3
    =iferror($g3*index($b$9:$b$11,match(vlookup(vlookup($f3,$a$3:$c$6,3,0),$a$3:$c$6,2,0),$a$9:$a$11,)),0)

    i3
    =iferror($g3*index($b$9:$b$11,match(vlookup(vlookup(vlookup($f3,$a$3:$c$6,3,0),$a$3:$c$6,3,0),$a$3:$c$6,2,0),$a$9:$a$11,)),0)

    j3
    =iferror($g3*index($b$9:$b$11,match(vlookup(vlookup(vlookup(vlookup($f3,$a$3:$c$6,3,0),$a$3:$c$6,3,0),$a$3:$c$6,3,0),$a$3:$c$6,2,0),$a$9:$a$11,)),0)
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-03-2017
    Location
    Manila, Philippines
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Pls help me find the right formula for this complicated worksheet.

    Quote Originally Posted by Bo_Ry View Post
    H3
    =iferror($g3*index($b$9:$b$11,match(vlookup(vlookup($f3,$a$3:$c$6,3,0),$a$3:$c$6,2,0),$a$9:$a$11,)),0)

    i3
    =iferror($g3*index($b$9:$b$11,match(vlookup(vlookup(vlookup($f3,$a$3:$c$6,3,0),$a$3:$c$6,3,0),$a$3:$c$6,2,0),$a$9:$a$11,)),0)

    j3
    =iferror($g3*index($b$9:$b$11,match(vlookup(vlookup(vlookup(vlookup($f3,$a$3:$c$6,3,0),$a$3:$c$6,3,0),$a$3:$c$6,3,0),$a$3:$c$6,2,0),$a$9:$a$11,)),0)

    Thank you so much! It works now!

+ 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] Complicated formula needed to find value in a range with multiple variables.
    By tml2424 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-05-2020, 04:22 AM
  2. [SOLVED] Formula to find # from worksheet b and add the 2 rows beneath that number on worksheet a
    By bdouglas1011 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-23-2017, 12:34 AM
  3. complicated find and replace
    By ammartino44 in forum Excel General
    Replies: 2
    Last Post: 08-14-2015, 03:39 PM
  4. Complicated Find Macro
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2014, 01:28 PM
  5. Replies: 3
    Last Post: 05-03-2012, 06:12 PM
  6. Complicated Find - Replace
    By abertrand in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2009, 01:13 PM
  7. Complicated Find Question!
    By Karoo News in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2006, 07:15 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