-Polak
asked on
Use Lookups to Simplify IF Long Formula
Hi Experts, I was hoping you could assist in helping me use indirects/lookups to simplify a an IF formula that I have.
Basically I want the indirect to look up the relevant value in the correct "XXXHrPerSortie" worksheets based on the selection in D14 .
The reason I'm looking for this is I'm wanting to expand D14 to have "Custom 1", "Custom 2", "Custom 3", etc.... and I do not want to have to limit/write the current formula up to a certain Custom Number.
Current Formula:
=IF($D$14="SOUTH WEST REGION (SWR)",$D$57*(INDEX(SWRHrP erSortie!I 2:I8,MATCH ($I3,SWRHr PerSortie! H2:H8,0))) /LawHours, IF($D$14="SOUTH EAST REGION (SER)",$D$57*(INDEX(SERHrP erSortie!I 2:I8,MATCH ($I3,SERHr PerSortie! H2:H8,0))) /LawHours, IF($D$14="NASO - NATIONAL AIR SECURITY OPERATIONS (NSO)",$D$57*(INDEX(NASOHr PerSortie! I2:I8,MATC H($I3,NASO HrPerSorti e!H2:H8,0) ))/LawHour s, IF($D$14="NORTHERN BORDER REGION (NBR)",$D$57*(INDEX(NBRHrP erSortie!I 2:I8,MATCH ($I3,NBRHr PerSortie! H2:H8,0))) /LawHours, IF($D$14="HQ AND CENTERS",$D$57*(INDEX(HQCH rPerSortie !I2:I8,MAT CH($I3,HQC HrPerSorti e!H2:H8,0) ))/LawHour s, IF($D$14="All",$D$57*(INDE X(AllHrPer Sortie!I2: I8,MATCH($ I3,AllHrPe rSortie!H2 :H8,0)))/L awHours))) )))
Basically I want the indirect to look up the relevant value in the correct "XXXHrPerSortie" worksheets based on the selection in D14 .
The reason I'm looking for this is I'm wanting to expand D14 to have "Custom 1", "Custom 2", "Custom 3", etc.... and I do not want to have to limit/write the current formula up to a certain Custom Number.
Current Formula:
=IF($D$14="SOUTH WEST REGION (SWR)",$D$57*(INDEX(SWRHrP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Each of your original sub-formulas were dividing the $D$57*INDEX(...(MATCH(...) ) result by LawHours, so I'm continuing that here. It doesn't matter where LawHours exists, just that it does. If you want to move my placement to another sample sheet, it will still work.
Note that I had to create this from scratch just guessing on the values shown in your initial formula. A redacted example workbook will always help Experts provide a more-meaningful result.
Note that I had to create this from scratch just guessing on the values shown in your initial formula. A redacted example workbook will always help Experts provide a more-meaningful result.
ASKER
Figured it out! I had moved around a column that was causing an #N/A value and I thought it had to do with LawHours; your solution worked great thank you!
You're welcome; glad I was able to help.
-Glenn
-Glenn
ASKER
As a follow-up thanks for letting me know that indirects can be used to lookup the values on Named Ranges. I did added this yesterday to the formula and it vastly simplified my life.
=IFERROR(IF($D$23<>"Manual Asset",($D$57*(INDEX(INDIR ECT(VLOOKU P($D$29,Wo rkforceReq sLookup,2, FALSE)&"!H 2:H8"),MAT CH($I3,IND IRECT(VLOO KUP($D$29, WorkforceR eqsLookup, 2,FALSE)&" !G2:G8"),0 )))/LawHou rs), ((($D$61*(INDIRECT(VLOOKUP ($D$29,Wor kforceReqs Lookup,3,F ALSE))))+( INDEX(INDI RECT(VLOOK UP($D$29,W orkforceRe qsLookup,2 ,FALSE)&"! H2:H8"),MA TCH($I3,IN DIRECT(VLO OKUP($D$29 ,Workforce ReqsLookup ,2,FALSE)& "!G2:G8"), 0))-(INDIR ECT(VLOOKU P($D$29,Wo rkforceReq sLookup,3, FALSE))))) *$D$63/Law Hours)),0)
=IFERROR(IF($D$23<>"Manual
ASKER
Open in new window
LawHours exists in Constants!$L$3 not in I2. I2 on my spreadsheet is just the title of the I3:I8 range. Further, LawHours is constant and does not change from the SWR, SER, NASO, NBR, HQC, ALL so I am confused why it is part of the vlookup....