Solved

Change a formula in one cell based on the value in another cell

Posted on 2013-12-19
5
248 Views
Last Modified: 2014-01-11
The following formula resides in column N:
=IFERROR(LOOKUP(2,1/('M:\xxx\[XXX_2014.xlsm]Workflow'!$H$2:$H$676=M2),'M:\xxx\[XXX_2014.xlsm]Workflow'!$J$2:$J$676),"")

I need to add a second formula in column N that references a different workbook that is very similar in structure but contains different data. The formula is as follows:
=IFERROR(LOOKUP(2,1/('M:\aaa\[XXX_2014.xlsm]Workflow'!$H$2:$H$676=M2),'M:\aaa\[XXX_2014.xlsm]Workflow'!$J$2:$J$676),"")

The trigger to determine which formula to use in column N is determined by the value in column V as follows:

If column V contains the phrase "Book 3", then use the SECOND formula above.
Otherwise, if column V is blank or contains any other phrase, then use the FIRST formula above.

How do I revise the current formula to meet the new requirements?

Thanks!
Andrea
0
Comment
Question by:Andreamary
5 Comments
 
LVL 22

Assisted Solution

by:Flyster
Flyster earned 250 total points
ID: 39729580
You should be able to use a IF statement for that:

IF(V1="Book 3", IFERROR(LOOKUP(2,1/('M:\aaa\[XXX_2014.xlsm]Workflow'!$H$2:$H$676=M2),'M:\aaa\[XXX_2014.xlsm]Workflow'!$J$2:$J$676),""), IFERROR(LOOKUP(2,1/('M:\xxx\[XXX_2014.xlsm]Workflow'!$H$2:$H$676=M2),'M:\xxx\[XXX_2014.xlsm]Workflow'!$J$2:$J$676),""))

Open in new window

Just change V1 to the row you need to refer to.

Flyster
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 250 total points
ID: 39729680
Can be further reduced to

=IFERROR(LOOKUP(2,1/if(v2="Book 3",('M:\aaa\[XXX_2014.xlsm]Workflow'!$H$2:$H$676=M2),'M:\aaa\[XXX_2014.xlsm]Workflow'!$J$2:$J$676),('M:\xxx\[XXX_2014.xlsm]Workflow'!$H$2:$H$676=M2),'M:\xxx\[XXX_2014.xlsm]Workflow'!$J$2:$J$676)),"")
0
 
LVL 31

Expert Comment

by:Rob Henson
ID: 39731335
Will both source books be open at the same time as the destination book?

If so, you could use INDIRECT and pull together the file path string using IF statements creating a different string for the two different files depending on the criteria specified.

If the source books will be closed, this won't work because INDIRECT doesn't work on closed books.

Thanks
Rob H
0
 

Author Comment

by:Andreamary
ID: 39732444
The source books will not always be open, but thanks for the suggestion.

I'm just implementing the formulas proposed above and should have feedback soon.

Andrea
0
 

Author Closing Comment

by:Andreamary
ID: 39773365
Thanks for the prompt responses and excellent solutions!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

23 Experts available now in Live!

Get 1:1 Help Now