Custom VBA what-if scenario function?

Kelvin Stott

Active Member
Joined
Oct 26, 2010
Messages
338
Hi, I need a non-invasive custom VBA "what-if" scenario function as follows:

WHATIF(Output_Cell, Cell1, Value1, Cell2, Value2, ...)

This would give the hypothetical value of the output cell if each of the given input Cells 1 to X were changed to the respective scenario values 1 to X, but without actually changing the values in those input or output cells. It should just return the hypothetical output value (i.e., solution) wherever the function is used, for example in another cell.

Is this possible, and does some code exist to do this already?

Many thanks,
Kelvin
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I think your question is too generic. It might be best to walk us through an example of exactly what you want to happen.

Some important details include?
- Where exactly do you intend to use this function? In a cell on your sheet (like other Excel functions), or in VBA (like other VBA functions)?
- What exactly is the calculation being performed?
- Please provide some sample data and expected output.

Pasting some images may be helpful. You cannot upload files to this site. But there are tools you can use to post screen images. They are listed in Section B of this link here: http://www.mrexcel.com/forum/board-a...forum-use.html.
Also, there is a Test Here forum on this board that you can use to test out these tools to make sure they are working correctly before using them in your question.
 
Upvote 0

Forum statistics

Threads
1,222,827
Messages
6,168,482
Members
452,192
Latest member
FengXue

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