Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Return a working formula from a Vlookup

Is there a way to return an executable formula from a lookup table?

I'm trying to select a specific formula to use based on a value in the
record (row) where I would perform the calculation. For example, based on a
code in the data record (row) the desired formula for row 75 might look like:

Code Formula
110 =(L75+(Q75*KPrice))
112 =(L75+(M75*Dprice)+(Q75*Kprice))

There are over 30 possible codes, each with unique calculations.

A workaround is to calculate the results using each possible formula in a
different column withn the row, use IF statements within each formula to set
the value to zero unless the code specified in the formula matches the code
in the data, and summing all the results across all the results columns. It
works, but brute-forcing it this way is very inefficient and slow.

Any Ideas?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 222
Default Return a working formula from a Vlookup

If you post all 30, perhaps I can merge them all into a single formula.
Here's a technique you can try.

First, convert your "codes" into a sequential response from 1-30:

LOOKUP(DS9,{40,45,55,60,100,110,112},{1,2,3,4,5,6, 7})
Or put the codes in a chart (codes in column A, numbers in column B
LOOKUP(DS9,$A$1:$A$30,$B$1:$B$30)

Now slip that whole formula into a CHOOSE function and list the "formulas"
in each of the Value1, Value2, Value3, etc...part of the equation.

=CHOOSE(LOOKUP(DS75,$A$1:$A$30,$B$1:$B$30),
(L75+(Q75*KPrice)),(L75+(M75*Dprice)+(Q75*KPrice)) ,L75/2)

....and on.
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Mr Machine" wrote:

Is there a way to return an executable formula from a lookup table?

I'm trying to select a specific formula to use based on a value in the
record (row) where I would perform the calculation. For example, based on a
code in the data record (row) the desired formula for row 75 might look like:

Code Formula
110 =(L75+(Q75*KPrice))
112 =(L75+(M75*Dprice)+(Q75*Kprice))

There are over 30 possible codes, each with unique calculations.

A workaround is to calculate the results using each possible formula in a
different column withn the row, use IF statements within each formula to set
the value to zero unless the code specified in the formula matches the code
in the data, and summing all the results across all the results columns. It
works, but brute-forcing it this way is very inefficient and slow.

Any Ideas?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP and return formula JE Excel Worksheet Functions 2 February 8th 09 11:53 PM
Row reference formula not working with a VLookup Roibn L Taylor Excel Worksheet Functions 4 July 21st 08 11:59 PM
Excel 2002: Vlookup formula not working Mr. Low Excel Discussion (Misc queries) 3 June 5th 07 02:49 PM
VLOOKUP formula not working. HELP! japc90 Excel Discussion (Misc queries) 4 April 30th 07 02:40 AM
VLOOKUP & Dates: Why is this Formula working? Ali Excel Worksheet Functions 1 January 18th 06 01:37 PM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"