+ Reply to Thread
Results 1 to 17 of 17

Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    Sheet 1, PTAE FY 13 Budget, Cell N3 is where I want the result of the formula that you help me with creating. (Thanks ahead of time).

    Sheet 4, BAH Table TN, is where the data resides. Columns A, B, C are named range "Zipcode"; Columns H -X are named range "TNBAH"

    I want to automate this cumbersome spreadsheet and thus far my formulas have worked very well; however, this final formula is given me a serious run for my money. The existing formula in cell N3 must be added to this new formula as that answer is to be added to the information that I believe an Index-Match formula will pull into the equation for the final answer.

    With that said, I want Cell N3 to take the soldier's Zipcode (Sheet 1, Cell E3) and reference range [ZIPCODE] and determine the AREA; I want it to reference range [SM] to determine if the soldier has Dependents (sheet 2, Pers Oct 2012, Column K); and finally reference range [SM] and determine the soldiers Rank (Sheet 2, Pers Oct 2012, Column E).

    Some Caveats.

    1. Sheet 2, Pers Oct 2012, Columns E and F mean the same, but Column E is needed for the Paydata information and then on the form (Sheet 1) the persons rank (Column F) is concatenated with the soldiers name.

    2. For Range [ZIPCODE], if the formula does not find the keyed zipcode (such as that in the example) then I want the formula to use the Table on Sheet 4, BAH Table TN, Columns W-X (ZZ590); otherwise, match the Area listed in Column B with the tables in columns I-V.

    3. Sheet 2, Range [SM], the number of dependents will range from 0-?? for each soldier.

    From the sample data, the formula would pull:

    Zipcode: 38451
    Dependents: (If >=1, "yes", "no") YES
    Rank: E-7

    With those data points, use the range [Zipcode] to determine if the zipcode keyed in Cell E3,Sheet 1, is not present in [Zipcode] and know to use table ZZ590 on columns W-X. It will see the soldier has dependents and use column W (ZZ590 table); It will then find the corresponding dollar amount for that soldier Rank (E-7 in this example) with the answer being: $1,245.00

    With that answer in hand, that $1,245.00 will be added to the formula currently in cell N3 showing a grand total of $1,593.44

    (Sigh!) What are your questions and I look forward to seeing your replies. I have tried many times using Vlookup and Index-Match combinations to no avail.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    wow thats quite a mouthful. it may take a bit of time for me to go through this, and i will probably be asking a bunch of questions as we progress, but im sure we will get where you need to be.

    1st off, sheet1 E3 zip code did not exist in your BAH table (as you said), so i changed it to 1 that did (for testing)

    2nd, the zip codes in BAH are all values, but the zip code on PERS is formatted as text - i changed that format to value so the vlookup will work

    will get back to you if i have more questions/comments
    Last edited by FDibbins; 10-11-2012 at 05:56 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    lets take this in stages...

    ok so if i understand you correctly, to the value of 348.44 in N3, you want to add (so far) 1383? if this is the case, use this formula to get the 1383 (or 1179 with no dependents)

    =INDEX(TNBAH,MATCH(I3,'BAH TABLE TN'!$H$4:$H$30,0)+3,MATCH(VLOOKUP(E3,zipcode,2,TRUE),'BAH TABLE TN'!I3:X3,0)+IF(ISNUMBER(VLOOKUP(D3,SM,11,FALSE)),1,2))

  4. #4
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    Good morning,

    Thanks for looking at this complicated problem with me and I am looking to learn from this process so treat me like a child when explaining the more complex formula issues.

    that is correct for the zipcode in the example, which a fact for some smaller cities and why those unlisted zipcodes need to pull from the ZZ590 table.

    I received this spreadsheet from another department and I am still working to correct the cell formats so thanks for catching that error.

  5. #5
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    First, this is definitely on the right track as I will explain below. I could not get the formula to pull anything but errors. See below.

    Quote Originally Posted by FDibbins View Post
    ok so if i understand you correctly, to the value of 348.44 in N3, you want to add (so far) 1383? if this is the case, use this formula to get the 1383 (or 1179 with no dependents)
    Based on the example, the zipcode of 38451, as it is not on the [zipcode] list, will pull its data from the table ZZ590 (Columns W-X). This would add the value of 348.44 in N3 to the amount of 1245 for a total of 1593 for an E-7, with dependents, living in zipcode 38451. If this E-7 with dependents lived in a zipcode falling in the Johnson City Area (such as 24201) the amount pulled would be 1149; in the Jackson Area 1146; and so forth.

    Quote Originally Posted by FDibbins View Post
    =INDEX(TNBAH,MATCH(I3,'BAH TABLE TN'!$H$4:$H$30,0)+3,MATCH(VLOOKUP(E3,zipcode,2,TRUE),'BAH TABLE TN'!I3:X3,0)+IF(ISNUMBER(VLOOKUP(D3,SM,11,FALSE)),1,2))
    I inserted this code into cell N4 and keyed the SSN so that all of the other fields would populate and it appears the formula is working in the right direction. However, the amount that pulled up (without the addition of the 348.44 for testing) was 1146 from U10 for the Jackson Area (which is close, but should be table ZZ590).

    Three good things, the formula pulled the correct rank, is in the WITH DEPENDENTS column and is on the correct sheet and row - far more than what I was able to pull off.

    How do I test with different zipcodes and with/without dependents?

    To test the formula I keyed in cell E4 the zipcode 24201 (which is on the [zipcode] table for Johnson City) and cell N4 did not change, even after telling the sheet to recalculate. DISREGARD This comment, I noticed that when I copied the formula that the cell references for D4 and E4 did not change accordingly. When I updated those references the amount did in fact change. WHICH IS AWESOME!

    Quote Originally Posted by FDibbins View Post
    =INDEX(TNBAH,MATCH(I3,'BAH TABLE TN'!$H$4:$H$30,0)+3,MATCH(VLOOKUP(E3,zipcode,2,TRUE),'BAH TABLE TN'!I3:X3,0)+IF(ISNUMBER(VLOOKUP(D3,SM,11,FALSE)),1,2))
    Can you explain the "+3" that is part of the first MATCH? I do not understand its purpose.

    Thank you...

    Tony
    Last edited by tstowe; 10-12-2012 at 10:10 AM.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    MATCH(I3,'BAH TABLE TN'!$H$4:$H$30,0)+3

    the match() range starts H4, but the index range (your named range TNBAH) starts in H1. the +1 adds the 3 extra rows needed

  7. #7
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    Quote Originally Posted by FDibbins View Post
    MATCH(I3,'BAH TABLE TN'!$H$4:$H$30,0)+3

    the match() range starts H4, but the index range (your named range TNBAH) starts in H1. the +1 adds the 3 extra rows needed
    That makes sense, although I did not know that you could do that. Cool.
    I really appreciate your help and I look forward to discussing this to fruition.

    have a great weekend.

  8. #8
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    Good morning,

    I want to thank you again for assisting me with this problem as the formula is appears to be working great. How do I acknowledge that you answered this correctly and give you the credit?

    One more request. The 1199 Column is the sum of the individuals BAH and BAS. Beginning in JAN-13 (column X), both BAH and BAS are increased by the percentage keyed in B3 and C3. Here is what I have partially working:

    =IF(ISBLANK(D29),"",O29+(O29*$B$3))+(IF(LEFT(J29)="E",PayData!$D$30,IF(OR(LEFT(J29)={"O","W"}),PayData!$D$29,""))+(IF(LEFT(J29)="E",PayData!$D$30,IF(OR(LEFT(J29)={"O","W"}),PayData!$D$29,""))*$C$3))

    When the soldier's SSN is keyed in column D, it appears that the amount shown column X is correct, but when the SSN is blank the sheet shows the error "#value!" in the cell.

    First, would you mind confirming that my formula IS providing the correct figure.
    Second, what must I do to remove the error message "#value!" when the SSN is not filled in?
    Lastly, what is a better formula to perform this calculation?

    Again, thank you!

    Tony

  9. #9
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    FDibbins,

    To ensure your formula was fully working I changed the number of dependents (column K on the PERS sheet) to see if the appropriate BAH table was used and it does not appear to be working correctly.

    Looking at sheet BAH TABLE TN you will note that each area had two payment columns: With Dep and Without Dep (Dependents). To explain, an E5, living in Chattanooga, with 1 or more dependents (identified in Column K on sheet PERS Oct 2012), will receive $1,125. By comparison, an E5, living in Chattanooga, with zero dependents will receive $921.

    What is your suggestion for making this possible with all of the areas?

    Thank you,

    Tony

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    i noticed that my formula only looks at the "no dependants" column if there is no entry in the "dependents" column...if you entering 0, it was recognising that as having depenants. i modified the formula to...
    Please Login or Register  to view this content.
    regarding your other question, its been a while since i played with this. the above formula calc's BAH (i think lol), and i would assume you want this added to whatever value has already been calc'd in N3? and then, if the date is Jan13 or later, you want the % applied to the existing N3 or to the total?

  11. #11
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    good morning,

    I updated the spreadsheet with your above formula and it is working as requested. THANK YOU!

    One more (hopefully the last for this post) question: How do I adjust the columns across the spreadsheet to include a payraise based on TIS? A soldier's TIS (Column M sheet Pers OCT 2012) is calculated based on Column L. When the soldier is moved into the next pay bracket, i.e. an E-7 with 25 years is paid $4,496.40 (located at Cell P17 sheet PayData) while an E-7 with 26 years is paid $4,815.90 (located at Cell Q17 sheet paydata), in the month of APRIL - how do I made this adjustment?

    The amount entered into P3 will be correct for the soldier's pay at that time (OCT of that year), but when his anniversary date arrives in the following year, say in July, then how do I make that month look at the soldier's PEBD (Column N) and determine if he moves into the next pay bracket. If he does, then apply the new pay amount to that cell and adjust the pay to the right.

    I am playing with the formulas to figure this out but I am struggling...

    Thanks

    Tony

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    i have your file at work, i will take a look and get back to you soon

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    on sheet1 M3, copied to all 1198 columns, try this...
    =INDEX(PayData!$B$1:$X$22,MATCH($I3,PayData!$B$1:$B$22,0),MATCH(-($J3-M$1)/365,PayData!$B$1:$X$1,1))

    for the info you provided, it gives 4209.30 from Oct-Dec, then changes to 4256.10 from jan onwards

  14. #14
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    Once again, you are dead on target! Thank you... Where do I send the check anyway?

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    hehe just glad i could help. shout if you need anything else

  16. #16
    Registered User
    Join Date
    10-11-2012
    Location
    Tennessee
    MS-Off Ver
    Excel 2007/Excel 2010
    Posts
    12

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    Believe me, I am beside myself with excitement. With this formula I did not know that I could use the dates along the top for each month as part of calculation. You have given me plenty to study and learn from and for that I am very thankful!

    How do you work through the problem to come with those solutions? When I define the problem out loud it makes sense, but when I try the formulas it gets all screwed up....

    Thank you,

    Tony

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Index - Match Formula help needed OR Most likely an entirely new formula.... HELP!

    for me, it works best if i start from the inside and work outwards...what column do i need to use and how do i find that using a formula...what answer do i need, where does it come from and how do i get it.

    when im working through a problem like yours, i often have formula snippets all over the place as i try to figure out the small details needed to arrive at the final answer...

    =INDEX(PayData!$B$1:$X$22,MATCH($I3,PayData!$B$1:$B$22,0),MATCH(-($J3-P$1)/365,PayData!$B$1:$X$1,1))

    eg 1st i need to find which row to use for the rank, so i used...=MATCH($I3,PayData!$B$1:$B$22,0)

    then i need to find the column to use, but that changes as the months progress. so for that, i 1st need to find out how many years to use...=-($J3-P$1)/365 this tells me the column to use, so i add a match() to that to ID the column number...=MATCH(-($J3-P$1)/365,PayData!$B$1:$X$1,1)

    join them all together and hey presto, it works lol

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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