Importing spreadsheet with help of if statements

xnolen

New Member
Joined
Feb 12, 2016
Messages
1
Is it possible to import a spreadsheet with an if statement?.
Example:
I need to import a spreadsheet from a list if I select a certain category.
If Cell A2 = any from the following list, Project, Open, Closed, All. I need it to import that list spreadsheet.
I know i can nest if statements in excel but can not figure out how to import a whole spreadsheet if one of these is selected.
Please if you know anything that can help me pleas let me know if this is possible, is there any if elseif statements I can use that could help me simplify my if statements as well? if its not possible let me know also. If not I will have to find a different way to go about this.
Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
An IF formula cannot import spreadsheets. It's just a formula that produces a result, either string or numerical. It can't open files.
Use VBA to import files.

Sounds like you need a VBA macro to open a file depending on what value you put in A2.
 
Upvote 0
I agree, you need some vba code. The good news is that it's easy to write. It would look something like....
Code:
Function MyFunction(MyCellValue)

select case MyCellValue

case "Project", "Open", "Closed", "All"
     'do something'
case else

end select
end function
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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