+ Reply to Thread
Results 1 to 10 of 10

IF statement with variable outcome

  1. #1
    Registered User
    Join Date
    01-17-2020
    Location
    Corpus Christi, TX
    MS-Off Ver
    2019
    Posts
    12

    IF statement with variable outcome

    1st Question:
    I am building an estimating spreadsheet and have a situation that has multiple ways of fabrication. How would I write IF($G$12="Lago Vista","Tile","XXX"). In this case "XXX" is the material in a different cell. That material can change dependent on other previous resolved factors. There are 6 multiple material choices for Cell "XXX".

    2nd question:
    Can I have a drop down list and an if statement in the same cell?
    Attached Files Attached Files
    Last edited by Jeff Rich; 01-17-2020 at 12:35 PM. Reason: Add an attachment

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF statement with variable outcome

    1) You replace the "XXX" with the cell reference. I apologize for the simplistic answer, I just don't see enough information to posit a more complex answer.

    IF($G$12="Lago Vista","Tile", $C$1)


    2) Yes, you can add Data Validation to a cell that also has a formula in it. I use this technique frequently in ORDER FORMS where I want some automation to occur the first time a row is filled out, but the user can override that automation (formula) with a drop down that offers other features.

    However, as soon as the user makes a selection from that drop down, the formula is erased forever in that cell. This is fine in the case of my ORDER FORM above, order forms (templates) are usually filled out once, so a new order would open a new pristine order form and the formulas are intact at the beginning.

    If your cells are not part of a template, and you need for those formulas to possibly be reinstated somehow, that would most likely require VBA... a macro that watches for certain cells to be changed to blank and it reinserts the original formula(s) in that instance.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: IF statement with variable outcome

    Formula in I6 would be
    =IF(F2="Lago Vista","Tile",I5)

    You can use data validation in I5

    No you can not have formula and dropdown.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    01-17-2020
    Location
    Corpus Christi, TX
    MS-Off Ver
    2019
    Posts
    12

    Re: IF statement with variable outcome

    Thank you Jerry.
    The simplest answer is exactly what I needed. I kept trying to write is about that basic but to no luck. I was missing or adding 1 item. LOL Thank you.
    I use a master sheet for each project, so disappearance of the formula if over written is okay. But I do like that Macro idea. I have no idea as to write or use one though. That will have to wait for another day.

    Thank you again for the help

  5. #5
    Registered User
    Join Date
    01-17-2020
    Location
    Corpus Christi, TX
    MS-Off Ver
    2019
    Posts
    12

    Re: IF statement with variable outcome

    Thank you Andy

  6. #6
    Registered User
    Join Date
    01-17-2020
    Location
    Corpus Christi, TX
    MS-Off Ver
    2019
    Posts
    12

    Re: IF statement with variable outcome

    Jerry-
    How would I write the data validation with a formula and a list in the same cell?

  7. #7
    Registered User
    Join Date
    01-17-2020
    Location
    Corpus Christi, TX
    MS-Off Ver
    2019
    Posts
    12

    Re: IF statement with variable outcome

    How would I write the formula and still have a drop down list?

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF statement with variable outcome

    You have to enter your formula into the cell first, preferably with a blank initial result.

    Then apply your Data Validation list settings to the cell itself to activate the drop down functionality.

    As long as you do not use the Drop Down, the formula can display any result.

  9. #9
    Registered User
    Join Date
    01-17-2020
    Location
    Corpus Christi, TX
    MS-Off Ver
    2019
    Posts
    12

    Re: IF statement with variable outcome

    Okay. Makes since. Thanks Again. You have been very helpful.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF statement with variable outcome

    Note, get that formula 100% first, it is tricky to edit that formula at all once the DV is active on the cell.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] if statement third outcome
    By steddas in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-08-2018, 09:57 AM
  2. [SOLVED] Outcome of a formula as value for a variable
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-20-2014, 11:32 AM
  3. [SOLVED] Multiple outcome if and statement
    By retroboy17 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-08-2014, 02:09 AM
  4. If statement outcome problem
    By devilchild99 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-18-2013, 09:25 PM
  5. [SOLVED] issue with outcome of if/then statement in VBA
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2013, 10:18 AM
  6. If Statement not recognising outcome
    By JoeSharp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2008, 07:18 AM
  7. How to calculate a sum as one outcome of an IF statement
    By barb in NC in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-31-2005, 03:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1