• IF THEN ELSE

    Author
    Topic
    #2483050

    Hi there,

    Does anybody know how to create IF THEN ELSE based off a drop down?

    I have the drop down set up but if I write the IF statement linked to the drop down when I hit TAB key it goes to the next drop down in the document and does not populate text. If there are no drop downs after this IF statement and I press TAB the text will appear. For my document layout this doesn’t work for me. If you have any other ideas how to get text to populate based off a drop down without having to press TAB I’m open to suggestions!

    Any ideas?

    Thank you in advance!

    Viewing 0 reply threads
    Author
    Replies
    • #2483285

      I hope I understand what you want.
      I use a table with List Data Validation to create my dropdown list.

      In the cell that I want the IF formula, I use the IFS formula. The IFS formula will allow up to 127 IFs to Then matches for the dropdown list.

      Example: List is from A2 thru A5 with the selected item selected shown in A1. Hide rows 2 – 5 so only the dropdown box in A1 shows. In the cell where you want a value based upon the selected cell from the dropdown list use the following formula in B1:

      =IF(A2=”Select Location”,A2,A2=A3,A3,A2=A4,A4,A2=A5,A5,A2=A6,A6)

      The formula works like this: If A2 value is equal to the value that was there when no selection has been made it will display that value. The next IF will match A2 value to the Value in A3 and if it is the value will place the value in B1. The rest of the formula compares each cell in the list to the one selected in A2 and will display the value of that cell in B1.

      In my example I had it report the value of the selected cell, but you can enter some other value based upon the cell selected.

      Not sure about the tab thing but tabs will not interfere in this formula and as you change the selection in the dropdown list the value in B1 will change too.

      I created an example and attached the file.

      Slight correction in formula…must list text in cell before dropdown selection and not refer to the cell by name (A2).

      Example-IFS

       

       

       

      HTH, Dana:))

      Attachments:
      • #2483302

        Thank you so much Dana! Does this formula apply to word 365 as well? I am mainly trying to work in word, but if I have to link to Excel it will be fine. I really appreciate your example as well. It makes sense. I was having issues in Word with writing the IF Formula because I was limited to something like this:

        Dropdown with options (just standard drop down list and have calculate on exit clicked and bookmarked as ddRank)

        Formula for Text Output based on dropdown selection:

        (done by selecting ctrl+F9 or it won’t recognize the formula by manually typing brackets)       { IF { REF ddRank }=”CAPTAIN” “captain of a ship”} then when you go to view mode (out of developer mode and protect the document), and test the formula you have to make the drop down selection and press TAB on the keyboard. This then populates “captain of a ship”.

        My issue is when I press TAB, it jumps to another drop down not related to this formula, and does not populate the “captain of a ship” wording.

        I hope that makes more sense?

        Thank you again!!

        • #2483384

          Those settings appear to be some older Legacy Field controls. Press Alt + F9 to toggle filed codes and you will see {FORMDROPDOWN}. I could not reproduce the problem you are experiencing. I offer the Excel sheet which you can insert into the Word document. Double clicking the inserted portion of the Excel worksheet will activate the dropdown list and formula.

          My only other advice that the {} of both the REF and IF field codes must be inserted with Ctrl + F9.

          I don’t quite understand how you have to click Tab after clicking your choice from the dropdown list as clicking the choice from the list should select it. Try clicking a space bar after clicking the entry just to exit the choice box.

          HTH, Dana:))

    Viewing 0 reply threads
    Reply To: IF THEN ELSE

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: