Run a formula from a cell referece

DylanGrimm

New Member
Joined
Apr 30, 2015
Messages
4
Is there a way to have a formula in a cell, then have a seperate formula refer to that fomula and run it for a selected value?

So if i have a $0.30 price in a cell, then a Vlookup next to that cell, an that vlookup looks up a seperate table that says for any price under $1.00 use a cell in that row which has an equation in it.


Any suggestions, or similar suggestions please let me know, thank you.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
That doesn't make a lot of sense, try adding a couple of examples.

I'm trying to figure out if you're looking for some beginner advice on formula nesting, or if you want to try and make a formula from concatenated strings.
 
Upvote 0
Like Jason said, your question is a little confusing. Next time, try creating exactly what you're picturing in your mind so it's clear what you're looking for. I'm going to give it a shot for you. Let me know if this is what you had in mind (simplified example).

#Price FloorPrice CeilingFormula to use
1$0.00$1.00=vlookup(blah blah)
2$1.00$5.00=sumif(blah blah)
3$5.00$15.00=count(blah blah)

<tbody>
</tbody>

$0.30=vlookup(blah blah)
$5.25=count(blah blah)

<tbody>
</tbody>


Now you have some cell that holds a price like $0.30. Next to that cell you want it to run vlookup(blah blah). Or if the price cell holds $5.25, you want it to run count(blah blah). The first question would be, why are the formulas so different that you need to structure it this way? I have a feeling you can revamp the formulas you're looking up in the price range table to work in all scenarios.

However, if you really want to set it up with completely different formulas based on the price, I would probably suggest using the CHOOSE function instead. I'll wait for some clarification on your request before diving into that.
 
Upvote 0
My apologies for the confusing question, I'm new into excel functions and bassically i have a table of Acceptable price points as below.
Under $1.000.250.330.390.440.450.490.550.590.650.690.750.790.880.890.99
$1.00 - $1.991.001.091.191.291.391.491.591.691.791.891.99
$2.00 - $2.99 2.192.292.392.492.592.692.792.892.99
$3.00 - $3.99 3.193.293.393.493.593.693.79 3.99
$4.00 - $4.99 4.194.294.394.494.594.694.79 4.99
$5.00 - $5.99 5.29 5.495.59 5.79 5.99
$6.00 - $6.99 6.29 6.496.596.79 6.99
$7.00 - $7.99 7.29 7.497.59 7.79 7.99
$8.00 - $8.99 8.29 8.498.59 8.79 8.99
$9.00 - $9.99 9.29 9.499.59 9.79 9.99
$10.00 - $14.99 xx.49 xx.99
$15.99 - $19.99min = 15.99 xx.49 xx.99
$20.00 - $29.99min = 21.99 xx.49 xx.99
$30.00 +min = 31.99 xx.49 xx.99

<colgroup><col style="width: 74pt; mso-width-source: userset; mso-width-alt: 3584;" width="98"> <col style="width: 48pt;" span="15" width="64"> <tbody>
</tbody>

Then i have a list of prices, so i was looking for a way to generate a formula that references this table and spits out the appropriate price point.
For example:
Price givenAcceptable price point
$ 0.34 $ 0.33
$ 1.22 $ 1.19
$ 5.67 $ 5.59
$ 9.86 $ 9.79
$ 10.27 $ 9.99
$ 45.18 $ 44.99

<colgroup><col style="width: 74pt; mso-width-source: userset; mso-width-alt: 3584;" width="98"> <col style="width: 48pt;" width="64"> <tbody>
</tbody>

Right now i have to do these conversions by hand, and i was wondering if their was an formula that could do it for me. I tried making one big IF function but it had too many nested fields since there were 130 or so IF's
 
Upvote 0
Based on the information in your duplicate thread (please take a moment to read the forum rules and posting guidelines).

Note that the formula can be simplified significantly if you list all of the additional valid prices up to and including 31.99 in the table rather than using the xx.49 or xx.99 format. The formula below is based on all of those prices being listed.

=IF($A2<=31.99,LARGE(IF(Sheet2!$B$1:$P$14<=$A2,Sheet2!$B$1:$P$14),1),FLOOR($A2,0.5)-0.01)

In the formula, the price to lookup was in $A2 and the table was in Sheet2!B1:P14.
 
Upvote 0
Oh got it, again appologies, I wont duplicate a question again.

But okay i think i see what your saying, so make a large table of all possible outcomes and have a formula similar to this reference that. I'll have to flirt around with the LARGE and FLOOR functions since i have never used them before, but you answered my question. Thank you for all your help.
 
Upvote 0
Sorry, I forgot to say that the formula must be confirmed as an array using Shift Ctrl Enter, otherwise the formula will return a #VALUE! error.
 
Upvote 0
If they were just in a long column of all the acceptable values (A3:A85) you could just use this. No ctrl+shift+enter needed.
Code:
=IF(A1>31.99,FLOOR(A1,0.5)-0.01,LOOKUP(A1,A3:A85))
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,547
Members
449,317
Latest member
chingiloum

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top