+ Reply to Thread
Results 1 to 9 of 9

Possible IF or VLookup Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    08-18-2016
    Location
    United States, Texas
    MS-Off Ver
    2010
    Posts
    13

    Possible IF or VLookup Formula

    I am trying to create a formula when cell H6 (validation criteria – drop down list) – Semester (text) is chosen another cell H20 (drop down also) defaults to 1 and locks the cell (H20) so that other options in the list are not available when H6 (Semester) is chosen from the drop-down list.

    How would I put this in a formula? Would I use a VLookup formula or an IF statement? Would I use conditional formatting also? The data validation is pulled from another sheet in the workbook labeled “Lookups.”

    See attachments

    Lookups.jpg

    Sem and Installments.jpg

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Possible IF or VLookup Formula

    cell H20 (drop down also) defaults to 1
    Do you mean that it is set to 1, but the user can still select a different value from the list? Or that it can only be 1?

    I suspect that what you describe must be done with macros, but you will need to attach your actual file. Images have limited value.

    The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-18-2016
    Location
    United States, Texas
    MS-Off Ver
    2010
    Posts
    13

    Re: Possible IF or VLookup Formula

    I cant really post the excel workbook because it contains confidential information.

  4. #4
    Registered User
    Join Date
    08-18-2016
    Location
    United States, Texas
    MS-Off Ver
    2010
    Posts
    13

    Re: Possible IF or VLookup Formula

    Excel Forum.xlsx

    See attachment

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,905

    Re: Possible IF or VLookup Formula

    One way:

    Create named range "Semester" (M14)

    Create named range "Num_of_Installments" (M14-M19)

    DV for H6

    Allow: List

    SOURCE: =IF(H6="Semester",semester,Num_of_Installments)

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,905

    Re: Possible IF or VLookup Formula

    If you add the following code in sheet1 it will clear H20 so ensuring a selection has to be made;


    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Not Intersect(Target, Range("H6")) Is Nothing Then
      If Target.Validation.Type = 3 Then
       Application.EnableEvents = False
       Target.Offset(14, 0).ClearContents  ' H20
      End If
    End If
    
    exitHandler:
      Application.EnableEvents = True
      Exit Sub
    
    End Sub
    to add code, right click on tab, "view code" and copy/paste above.
    Attached Files Attached Files
    Last edited by JohnTopley; 05-04-2018 at 03:06 PM.

  7. #7
    Registered User
    Join Date
    08-18-2016
    Location
    United States, Texas
    MS-Off Ver
    2010
    Posts
    13

    Re: Possible IF or VLookup Formula

    This is what I have so far:

    =IF(AND(H6="Semester",H20=1),1,0),IF(H6="Cohort"or H6=“A La Carte”, and H20 is not blank then I20

    = 1, however if H20 is blank then I20 =0.

    How would you refine this and put this into a formula?

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Possible IF or VLookup Formula

    You are describing H6, H20, I20, but none of those cells can be determined from the images you posted. It is difficult to get the context.

    Just going by your description

    =IF(AND(H6="Semester",H20=1),1,0),IF(H6="Cohort"or H6=“A La Carte”, and H20 is not blank then I20

    I can't tell what you mean by this formula. You have two separate IF functions, which is not legal. Can you just describe the logic of what you want, instead of trying to show it in a formula? The best I can do is make some guesses:

    =IF(AND(H6="Semester",H20=1),1,IF(AND(OR(H6="Cohort",H6="A La Carte"),H20<>""),I20,"??"))

    There is one condition that you still need to cover. An example is H6="Cohort" AND H20 is blank.

    There there is

    = 1, however if H20 is blank then I20 =0.

    Is this formula in cell I20? If so then

    =IF(H20="",0,1)

    None of this relates to dropdowns or data validation as you mentioned in your first post. You can't put either of these formulas into cells that have data validation with a dropdown list.

  9. #9
    Registered User
    Join Date
    08-18-2016
    Location
    United States, Texas
    MS-Off Ver
    2010
    Posts
    13

    Re: Possible IF or VLookup Formula

    If H6 equals "Semester" then H20 is changed to 1 and I20 is changed to 1, if 2 and up is chosen in H20 when H6 equals "Semester" than I20 will equal 0

    in addition to that if "Cohort" or "A La Carte" is chosen in H6 (instead of "Semester") and a number 1 or above is chosen in H20 then I20 will equal 1

    if H20 is left blank then I20 will equal 0

+ 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] VLOOKUP formula or VLOOKUP worksheet.function
    By Crispy85 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2017, 09:40 AM
  2. Replies: 5
    Last Post: 12-07-2016, 09:18 AM
  3. VBA external VLOOKUP instead of VLOOKUP-formula in cell
    By ExcelBonk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2016, 02:41 PM
  4. [SOLVED] Vlookup with column name instead of col_index_name(3rd Section of Vlookup formula)
    By akulka58 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-21-2014, 10:42 AM
  5. [SOLVED] VBA code for change vlookup formula to vlookup formula with ISNA
    By erprasannaa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 03:33 AM
  6. Vlookup referencing a vlookup formula
    By laurenann in forum Excel General
    Replies: 1
    Last Post: 01-24-2011, 05:52 PM
  7. vlookup-reate a vlookup formula?
    By Pam C in forum Excel General
    Replies: 1
    Last Post: 03-16-2006, 12:15 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