+ Reply to Thread
Results 1 to 4 of 4

Return a value based on cells above the referenced cell

  1. #1
    Registered User
    Join Date
    02-17-2021
    Location
    Australia
    MS-Off Ver
    365
    Posts
    3

    Return a value based on cells above the referenced cell

    Hi All,

    Trying to wrap my head around creating a formula for the cell to return values based on the values above a referenced cell. Example I'm trying to make Column C return "Y"s for any value that is equal or less than 10 in column B, and if it is higher than 10 that it will return "N" for 4 rows after that. E.g.

    B2 = 13 so, C2 = N
    ^ value above 10
    B3 = 0 so, C3 = N
    ^ 1st row after a value above 10
    B4 = 0 so, C4 = N
    ^ 2nd row after a value above 10
    B5 = 0 so, C5 = N
    ^ 3rd row after a value above 10
    B6 = 0 so, C6 = N
    ^ 4th row after a value above 10
    B7 = 0 so, C7 = Y
    ^ after the 4th row where the referenced cell was higher than 10 return value is Y
    B8 = 0 so, C8 = Y
    ^ after the 4th row where the referenced cell was higher than 10 return value is Y
    B9 = 0 so, C9 = Y
    ^ after the 4th row where the referenced cell was higher than 10 return value is Y
    B10 = 0 so, C10 = Y
    ^ after the 4th row where the referenced cell was higher than 10 return value is Y
    B11 = 0 so, C11 = Y
    ^ after the 4th row where the referenced cell was higher than 10 return value is Y
    Has anyone created a query like this? Please help. I also attached the workbook as to which I'm working on.

    Thanks,

    Raymond
    Attached Files Attached Files

  2. #2
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Return a value based on cells above the referenced cell

    Here's a quick and easy way using D as a helper column

    In D2 and drag down
    =IF(B2>10,1,IF(C2=C1,D1+1,1))

    In C2
    =IF(B2>10,"N","Y")

    In C3 and drag down
    =IF(AND(C2="N",D2<5),"N",IF(B3>10,"N","Y"))

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,774

    Re: Return a value based on cells above the referenced cell

    Welcome to the forum.

    Please add 20-30 rows of expected outcomes in C and post the workbook again.

    B7 = 0 so, C7 = Y
    However, B7 is not 0, it's 1, so ... ?
    Last edited by AliGW; 02-17-2021 at 03:43 AM.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    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: Return a value based on cells above the referenced cell

    please fill about 25 expected results ONTO your sheet, as I cannot follow the logic, especially down around rows 13-18 of your real data. Also explain why C2 is N when B2 is >10??!!
    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

+ 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] Return a text value if the referenced cell contains any value.
    By Davecv67 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-11-2021, 05:02 PM
  2. [SOLVED] If Function - Return value 0 when referenced cell is also 0
    By fleyd in forum Excel General
    Replies: 5
    Last Post: 08-03-2015, 06:41 AM
  3. Formatting a cell based on the referenced cells fomat
    By Theo893 in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 04-23-2015, 12:28 PM
  4. how do I return value of a referenced cell?
    By dreamwalker in forum Excel General
    Replies: 3
    Last Post: 03-13-2011, 07:26 AM
  5. [SOLVED] How can I return a cross referenced cell value?
    By JR in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  6. [SOLVED] How can I return a cross referenced cell value?
    By JR in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. How can I return a cross referenced cell value?
    By JR in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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