+ Reply to Thread
Results 1 to 8 of 8

Formula to return Yes/No if it finds negative with data set,

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Formula to return Yes/No if it finds negative with data set,

    Hi All,

    I have an employee data set with staff numbers, names, pay periods and in the last column a change in pay (if any), positive or negative.

    The date set for each employee has 61 lines (always 61), however I'm only looking to check the most recent 26 rows for each (always the top 26) for a negative value, i.e. a reduction. If it finds one then return Yes, else No etc

    I'm using Index/Match elsewhere in the sheet, any I'm thinking there could be a variation of that but I'm unsure!

    I've attached an example with the last 26 highlighted in yellow for 3 employees, would anyone have an idea for a formula?

    Any help is appreciated.

    Thanks

    Dave

    ddNegatives in last 26 weeks.xlsx

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to return Yes/No if it finds negative with data set,

    In your sample file Employees 50 and 99 have 27 rows highlighted!

    Try this...

    Data Range
    G
    H
    2
    Employee 1
    Yes
    3
    Employee 50
    Yes
    4
    Employee 99
    No


    This formula entered in H2 and copied down:

    =IF(COUNTIF(OFFSET(E$2,MATCH(G2,B:B,0)-2,0,26),"<0"),"Yes","No")

    Note that the sample has calculation set to manual!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Formula to return Yes/No if it finds negative with data set,

    Hi Tony,

    Thanks for responding, and apologies I highlighted 27 rows. The solution looks excellent however I'm not 100% sure I've implemented it correctly.

    I have my dataset arranged diffrently, would you mind checking the attached sample?

    Thanks

    DavidNegatives in last 26 weeks 2.xlsx

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to return Yes/No if it finds negative with data set,

    Like this...

    Entered on the Calculations sheet in cell D3:

    =IF(COUNTIF(OFFSET(Sheet1!X$2,MATCH(B3,Sheet1!B:B,0)-2,0,26),"<0"),"Yes","No")

    Copy down as needed.

  5. #5
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Formula to return Yes/No if it finds negative with data set,

    Thats great Tony, thanks for the solution and confirmation. It looks like that will work perfectly.

    Thanks

    David

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to return Yes/No if it finds negative with data set,

    You're welcome. Thanks for the feedback!

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Formula to return Yes/No if it finds negative with data set,

    Wow!! What time in the morning is it for you, Biff?

    Pete

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to return Yes/No if it finds negative with data set,

    5:54 AM


+ 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. Excel formula If A is true then check B and if B is negative then return
    By andreasnw in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-18-2013, 08:42 AM
  2. [SOLVED] Make value negative if it finds certain text
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2013, 10:14 PM
  3. Replies: 4
    Last Post: 03-12-2013, 06:37 AM
  4. Hello| Formula To Return 1 if positive, o, if negative
    By scuba2x2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-03-2013, 09:39 AM
  5. need IF function to return 0 if it finds a one out of three words
    By aledger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-28-2005, 09:06 PM

Tags for this Thread

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