Solved

Use Lookups to Simplify IF Long Formula

Posted on 2014-07-28
6
154 Views
Last Modified: 2014-07-30
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(SWRHrPerSortie!I2:I8,MATCH($I3,SWRHrPerSortie!H2:H8,0)))/LawHours, IF($D$14="SOUTH EAST REGION (SER)",$D$57*(INDEX(SERHrPerSortie!I2:I8,MATCH($I3,SERHrPerSortie!H2:H8,0)))/LawHours, IF($D$14="NASO - NATIONAL AIR SECURITY OPERATIONS (NSO)",$D$57*(INDEX(NASOHrPerSortie!I2:I8,MATCH($I3,NASOHrPerSortie!H2:H8,0)))/LawHours, IF($D$14="NORTHERN BORDER REGION (NBR)",$D$57*(INDEX(NBRHrPerSortie!I2:I8,MATCH($I3,NBRHrPerSortie!H2:H8,0)))/LawHours, IF($D$14="HQ AND CENTERS",$D$57*(INDEX(HQCHrPerSortie!I2:I8,MATCH($I3,HQCHrPerSortie!H2:H8,0)))/LawHours, IF($D$14="All",$D$57*(INDEX(AllHrPerSortie!I2:I8,MATCH($I3,AllHrPerSortie!H2:H8,0)))/LawHours))))))
0
Comment
Question by:-Polak
  • 3
  • 3
6 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40224798
This is hard for me to test without actual values (ex., "LawHours" value, value in I3, value in D57), but try this:
=$D$57*(INDEX(INDIRECT(VLOOKUP($D$14,$D$2:$E$7,2,FALSE)&"!I2:I8"),MATCH($I3,INDIRECT(VLOOKUP($D$14,$D$2:$E$7,2,FALSE)&"!H2:H8"),0)))/LawHours

Replace the range $D$2:$E$7 with the range that describes the valid values for D14 and their associated worksheet names.  You can rename this as a range name and move to any other worksheet in your workbook if you like.

See my example workbook to follow.

 -Glenn
EE-Q-28485381.xlsx
0
 
LVL 1

Author Comment

by:-Polak
ID: 40224952
Okay, I followed you up until
&"!I2:I8")

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....
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40224975
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.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:-Polak
ID: 40225058
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!
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40225083
You're welcome; glad I was able to help.
-Glenn
0
 
LVL 1

Author Comment

by:-Polak
ID: 40229243
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(INDIRECT(VLOOKUP($D$29,WorkforceReqsLookup,2,FALSE)&"!H2:H8"),MATCH($I3,INDIRECT(VLOOKUP($D$29,WorkforceReqsLookup,2,FALSE)&"!G2:G8"),0)))/LawHours), ((($D$61*(INDIRECT(VLOOKUP($D$29,WorkforceReqsLookup,3,FALSE))))+(INDEX(INDIRECT(VLOOKUP($D$29,WorkforceReqsLookup,2,FALSE)&"!H2:H8"),MATCH($I3,INDIRECT(VLOOKUP($D$29,WorkforceReqsLookup,2,FALSE)&"!G2:G8"),0))-(INDIRECT(VLOOKUP($D$29,WorkforceReqsLookup,3,FALSE)))))*$D$63/LawHours)),0)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tags from access to excel 3 28
Match formula returns N/A 5 25
Adding Text that self adjusts in a Cell 8 33
Auto Adjust Percent rate 5 30
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now