+ Reply to Thread
Results 1 to 6 of 6

nested if statement honoring conditions within a vba loop

  1. #1
    Registered User
    Join Date
    06-29-2016
    Location
    Houston, texas
    MS-Off Ver
    10
    Posts
    4

    nested if statement honoring conditions within a vba loop

    Any and all help greatly appreciated!! This problem is driving me madder than a box of frogs!!

    Column E has sequential numbers beginning cell E8 with value 1, E9 with value 2 etc with values increasing by 1 onward until cell E420.

    Column I has descending values starting from cell I8 (value 2950) and getting smaller each row down until row E420

    Cell C10 has a value of 5.
    Cell C9 has a value of 3000.

    I would like to find the vba equation that allows me to enter data in Column G, beginning in cell G8 all the way down to cell G420.

    I need the equation to honor the following conditions:-

    If Cells in Column E (starting cell E8 with value 1, E9 with value 2 etc) have values lower or equal to cell C10 (value 5) then enter value of cell C9 (value 3000) into Cells in column G beginning in cell G8.

    If cells in Column E have a value greater than cell C10 (value of 5) then enter the value of column I beginning with value in cell I8. In this example Cell C13 would have the value of I8 and cell C14 would have the value of cell I9 all the way down until cell C420 has a value I415.

    Many thanks,

  2. #2
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: nested if statement honoring conditions within a vba loop

    I Think this is what you are after...place in G8
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  3. #3
    Registered User
    Join Date
    06-29-2016
    Location
    Houston, texas
    MS-Off Ver
    10
    Posts
    4

    Re: nested if statement honoring conditions within a vba loop

    Thanks mongoose38. I forgot to mention that cell c10 could be any value from a drop down menu with values ranging from 1 through to 15. Will the above equation you provided still work given this information?

    Thanks again for you help, it is greatly appreciated.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: nested if statement honoring conditions within a vba loop

    Put this in G8 and drag down

    =IF(E8<$C$10, $C$9, INDEX(I:I, ROW(I8)-COUNTIF($E$8:$E$450,"<"&$C$10), 1)
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    06-29-2016
    Location
    Houston, texas
    MS-Off Ver
    10
    Posts
    4

    Re: nested if statement honoring conditions within a vba loop

    Many thanks mongoose36, very much appreciated.

  6. #6
    Registered User
    Join Date
    06-29-2016
    Location
    Houston, texas
    MS-Off Ver
    10
    Posts
    4

    Re: nested if statement honoring conditions within a vba loop

    Many thanks mikerickson, very much appreciated.

+ 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. Replies: 2
    Last Post: 07-09-2015, 04:25 PM
  2. Nested If Statement with Multiple Logical Conditions
    By gatefire08 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-18-2014, 12:17 PM
  3. [SOLVED] 3 conditions coming from one cell.. Nested If Statement??
    By trosasco in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2013, 02:52 PM
  4. Nested If loop with multiple conditions
    By schaasyd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2012, 08:16 AM
  5. Replies: 11
    Last Post: 10-26-2011, 03:24 PM
  6. Need help with For... loop that has a nested if statement
    By iLurk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-24-2009, 06:46 PM
  7. Nested IF statement 3 conditions 3 outcomes
    By Nick_in_Dubai in forum Excel General
    Replies: 1
    Last Post: 03-12-2009, 04:38 AM

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