+ Reply to Thread
Results 1 to 15 of 15

Last cells with condition

  1. #1
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Last cells with condition

    Hi,

    I'd like to find the lowest price on all last Green cells
    When it is Red, stop calculating.
    In the file attached, the formula should give the price : 200

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Last cells with condition

    Enter this formula into any cell using Ctrl Shift Enter.

    =MIN(IF(INDIRECT("A" & MATCH("Red",A1:A6,0) & ":A6")="Green",INDIRECT("B" & MATCH("Red",A1:A6,0) & ":B6"),9^99))
    Last edited by mehmetcik; 01-17-2019 at 09:30 AM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Last cells with condition

    =MIN(INDEX(B:B,AGGREGATE(14,6,ROW(A2:A600)/(A2:A600<>"Green")/NOT(ISBLANK(A2:A600)),1)+1):A600)

  4. #4
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    Thank you for your reply.

    It returns #VALUE! (on the A2:A6="Green")

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Last cells with condition

    Enter this formula into any cell using Ctrl Shift Enter.

    Press and hold ctrl, press and hold shift, press enter.

    =MIN(IF(INDIRECT("A" & MATCH("Red",A1:A6,0) & ":A6")="Green",INDIRECT("B" & MATCH("Red",A1:A6,0) & ":B6"),9^99))

  6. #6
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    Quote Originally Posted by tim201110 View Post
    =MIN(INDEX(B:B,AGGREGATE(14,6,ROW(A2:A600)/(A2:A600<>"Green")/NOT(ISBLANK(A2:A600)),1)+1):A600)
    Thanks.
    It returns 0

  7. #7
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    Quote Originally Posted by mehmetcik View Post
    Enter this formula into any cell using Ctrl Shift Enter.

    Press and hold ctrl, press and hold shift, press enter.

    =MIN(IF(INDIRECT("A" & MATCH("Red",A1:A6,0) & ":A6")="Green",INDIRECT("B" & MATCH("Red",A1:A6,0) & ":B6"),9^99))


    Still #VALUE!
    Am I doing something wrong?
    Attached.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Last cells with condition

    Yes.

    you did not use ctrl Shift Enter
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    Quote Originally Posted by mehmetcik View Post
    Yes.

    you did not use ctrl Shift Enter
    I did, nothing happened.
    Appreciate it. thanks a lot

  10. #10
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    I tried it with different values, when you change A5 into Red, the formula calculates wrong.
    Attached.
    Thanks
    Attached Files Attached Files

  11. #11
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Last cells with condition

    Please try

    =MIN(INDEX(B:B,MATCH(2,INDEX(1/(A1:A999<>"Green")/(A1:A999<>""),))+1):B999)

  12. #12
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    Doesn't work when the last cell is Red

  13. #13
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Last cells with condition

    Please try with Ctrl+Shift+Enter

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    01-17-2019
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    40

    Re: Last cells with condition

    Looks good. that's a long, complicated and impressive formula.
    Thanks!

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Last cells with condition

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Condition formatting of multiple condition formatted cells
    By merrin84 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-22-2015, 05:08 PM
  2. [SOLVED] Macro to copy cells into another column if cells contain a certain condition
    By lsm33000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 02:27 PM
  3. [SOLVED] if condition excel formula from 4 cells values result as of conditions of two cells
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2013, 06:25 AM
  4. Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition
    By Mark V. in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-07-2013, 12:45 PM
  5. [SOLVED] IF Condition to date cells with concatenation of two text cells
    By desibird in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-26-2013, 03:28 PM
  6. [SOLVED] IF Condition: two cells with dates and concatenation of corresponding 2 text cells
    By desibird in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-25-2013, 10:38 AM
  7. How do you protect cells on condition of other cells having data inputted?
    By rickd909 in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 01-18-2007, 06:44 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