+ Reply to Thread
Results 1 to 5 of 5

Populate Based On Criteria

  1. #1
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Populate Based On Criteria

    Hi,

    I have the attached table.


    The formula in column E and F are based on the following criteria:

    1) If the price drops by 2%, then buy
    2) When the price rises by 2%, then sell
    3) You can only buy once and can only buy again after you sell


    So far the formula works but the formula sells after buying even though the selling price is lower than the buying price. Example is in cell E10, we bought at 22.6 after the price fell more than 2% but sold in cell F22 for 21.4 after price changes by more than 6%. However, this price is lower than the buy price.

    Is there a way to modify this formula to add the criteria that it can only sell if the change in the price is more than 2% but also the sell price must be more than the buy price ?

    Appreciate all the help.

    I have a cross post here:

    https://www.mrexcel.com/board/thread.../#post-5808181
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Populate Based On Criteria

    Maybe in E5
    =IF(AND($D5<=-0.02,IFERROR(MATCH(10^10,E$4:E4),0)<=IFERROR(MATCH(10^10,F$4:F4),0)),$C5,"")

    and in F5
    =IF(AND(N(LOOKUP(2,1/(E$4:E4<>""),E$4:E4))<C5,D5>=0.02,IFERROR(MATCH(10^10,E$4:E4),0)>=IFERROR(MATCH(10^10,F$4:F4),0)),C5,"")

    I messed up your formulae in parts of G H and I...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Populate Based On Criteria

    Try this . A small change in second formula of Sell.
    In F5 then copied down

    =IF(AND($C5>$C$5,$D5>=0.02,IFERROR(MATCH(9.99E+307,F$4:F4),0)<=IFERROR(MATCH(9.99E+307,E$4:E4),0)),$C5,"")
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Re: Populate Based On Criteria

    Hi Glenn and murthy,

    That worked. Thank you very much for your valuable time and patience. Have a great day.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Populate Based On Criteria

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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. Populate cell based on criteria
    By red1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2018, 07:38 AM
  2. Populate cells based on 3 criteria.
    By danallamas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2015, 09:24 AM
  3. Using VBA to populate cells based on a criteria in another tab
    By mongoose36 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-07-2013, 02:12 PM
  4. Populate Data Based On Criteria
    By Kumara_faith in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-12-2013, 10:40 AM
  5. Populate Based on Criteria
    By Kumara_faith in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-12-2013, 02:37 AM
  6. Lookup Based On Criteria and Populate
    By Kumara_faith in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-03-2012, 03:24 PM
  7. Populate Value Based On Criteria
    By Kumara_faith in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-09-2008, 10:31 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