Modify formula based on value in a cell.

RodneyW

Active Member
Joined
Sep 24, 2010
Messages
489
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I am currently using this formula:

=ROUNDUP('Number of Golfers'!$C$7*'Food & Beverage'!J5,0)

and it works well however I want to set it up so that I can easily show results based on a specific month I may want to review. Number of Golfers'!$C$7 refers to the month of May. Number of Golfers'!$E$7 would refer to the month of June, Number of Golfers'!$G$7 would refer to the month of July and so on.

Is there a way I can enter the month in a cell, lets say in U2 I had a drop down menu where people could select the month they want to review, lets say they select July and this formula =ROUNDUP('Number of Golfers'!$C$7*'Food & Beverage'!J5,0) would modify to =ROUNDUP('Number of Golfers'!$G$7*'Food & Beverage'!J5,0)?

I'm only showing the formula from one cell but there are numerous cells with similar formulas that would use the same concept.

Thanks in advance
 
you could use a nested IF

=IF(U2="May",ROUNDUP('Number of Golfers'!$C$7*'Food & Beverage'!J5,0),IF(U2="june",ROUNDUP('Number of Golfers'!$E$7*'Food & Beverage'!J5,0),IF(U2="july",ROUNDUP('Number of Golfers'!$G$7*'Food & Beverage'!J5,0),"")))

assuming U2 is text and NOT a real date - If a real date then need a different formula and probably need the year as well

i'm assuming you are still using 2013 - if not please
What version of excel are you using - would be worth updating your profile to show version as solutions will be dependant on what version you have and therefore what functions available

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)


A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
Solution
If the month number is entered in U2 and May is the earliest month (U2=5)

Excel Formula:
=ROUNDUP(INDEX('Number of Golfers'!$C$7:$N$7,1,(U2-5)*2+1)*'Food & Beverage'!J5,0)
 
Upvote 0
you could use a nested IF

=IF(U2="May",ROUNDUP('Number of Golfers'!$C$7*'Food & Beverage'!J5,0),IF(U2="june",ROUNDUP('Number of Golfers'!$E$7*'Food & Beverage'!J5,0),IF(U2="july",ROUNDUP('Number of Golfers'!$G$7*'Food & Beverage'!J5,0),"")))

assuming U2 is text and NOT a real date - If a real date then need a different formula and probably need the year as well

i'm assuming you are still using 2013 - if not please
What version of excel are you using - would be worth updating your profile to show version as solutions will be dependant on what version you have and therefore what functions available

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)


A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
Thanks. Shame on me for not updating my profile. I'm now on Office 365. I'll try and post a sample later tonight, or more likely tomorrow. I need to head out for a couple jobs. I may try your nested solution as I think it will work. Thanks again.
 
Upvote 0
If the month number is entered in U2 and May is the earliest month (U2=5)

Excel Formula:
=ROUNDUP(INDEX('Number of Golfers'!$C$7:$N$7,1,(U2-5)*2+1)*'Food & Beverage'!J5,0)
This looks like an interesting option as well, thanks
 
Upvote 0

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