+ Reply to Thread
Results 1 to 9 of 9

Ignore "-1" in formula

  1. #1
    Registered User
    Join Date
    07-18-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    84

    Ignore "-1" in formula

    Hello

    I have this formula

    =INDEX([TUE.xlsx]Who_Did_What!$D1:$D10000,MATCH(1,($F7 = [TUE.xlsx]Who_Did_What!$C$1:$C$10000)*([TUE.xlsx]Who_Did_What!$D$1:$D$10000<>""),0))

    Column D in "TUE.XLSX" has many '-1's in it so therefore the cell with this formula in it returns -1

    The cell with the formula is trying to return an employee ID of which im doing a VLOOKUP to match a name with. There is nobody with this ID '-1'.

    What can i put in this formula to ignore minus numbers or just specifically -1.

    It has to be in this formula as the users are not advanced users and will not know anything about formulas.

    I attached an example - cant attach the original for DP reasons

    Thanks
    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 2403
    Posts
    44,064

    Re: Ignore "-1" in formula

    Not a very helpful sample!! What are your expected results? There are 4 entries for cheese, with 3 different values in colun D. Which on/ones do you expect to get back?
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: Lá fhéile Pádraig sona dhaoibh

  3. #3
    Registered User
    Join Date
    07-18-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    84

    Re: Ignore "-1" in formula

    I've attached literally a mirror image of what i am working with, see attached.

    So i want to see ID '130' in cell I7, sheet 2. But the formula stops at -1 or sometimes 0.

    Like i said before, nobody has -1 or 0 as their ID so i wish the formula to ignore this.

    Raw data in sheet 1.

    The raw data will be in another worksheet but as mentioned before to me this doesn't matter.
    Attached Files Attached Files

  4. #4
    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,981

    Re: Ignore "-1" in formula

    Like i said before, nobody has -1 or 0 as their ID so i wish the formula to ignore this.
    Sheet 1 - cell D3.
    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.

  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 2403
    Posts
    44,064

    Re: Ignore "-1" in formula

    Why 130 and not 874 (row 2)??... or 766 for that matter!!
    Last edited by Glenn Kennedy; 07-20-2018 at 09:10 AM.

  6. #6
    Registered User
    Join Date
    07-18-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    84

    Re: Ignore "-1" in formula

    I will try to explain further.

    You helped me with the same sheet a few days ago.
    The product that is F7 "288 GH SMALL ITEM", sheet 2, is the product i am trying to find the corresponding employee ID in row D, sheet 1.

    The difference between employee number 874 and employee number 130 is that 874 does not have an employee name attached to it, as you can see in E1 (sheet 1). I do not know why this is because this has been exported from another program external to excel, so sorry can't explain that one. I'm guessing it is a way of identifying a type of action performed.

    Just like the other problem you helped me solve, the formula i'm guessing, is picking up the first corresponding value in column D, which was -1. And again, -1 has no employee attached to it so therefore i wish to skip pass -1 (and also 0) and go to the next corresponding value in column D, which is "130", name "Richard Smith".

    Hope this makes sense,

    If not please ask away. The sheet is literally a mirror image, i've just changed the names of products and people. Obvious reasons.

    Thank you

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

    Re: Ignore "-1" in formula

    That's it... I either didn't see... or you didn't explain clearly enough that an employee name had to be there... Either way, it's clear, now:

    =IFERROR(INDEX(Sheet1!$D$2:$D$19,MATCH(1,INDEX((Sheet1!$C$2:$C$19=Sheet2!F7)*(Sheet1!$E$2:$E$19<>"")*(Sheet1!$D$2:$D$19>0),0),0)),"")

    an ordinary formula (not array entered)
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-18-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    84

    Re: Ignore "-1" in formula

    Thanks for this Glenn

    Can i ask what was changed because immediately i cant tell (and so i can learn too)

    p.s. it works on the real sheet too thank you again!!!

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

    Re: Ignore "-1" in formula

    =IFERROR(INDEX(Sheet1!$D$2:$D$19,MATCH(1,INDEX((Sheet1!$C$2:$C$19=Sheet2!F7)*(Sheet1!$E$2:$E$19<>"")*(Sheet1!$D$2:$D$19>0),0),0)),"")

    Red: adds a condition where E is non-blank

    Green: removes the need for entry as an array formula.


    You're welcome.



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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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] Pivot Table / Chart Ignore / Exclude blank "" cells created using IF formula
    By randomreflex in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 05-23-2018, 08:59 AM
  2. If one cell =0, ignore other formula and show "0"
    By robbielaybourn in forum Excel General
    Replies: 2
    Last Post: 07-14-2017, 10:12 AM
  3. Data Validation - how to ignore cells with "0" or "-"
    By dgibney in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-29-2015, 08:16 PM
  4. [SOLVED] array formula count "number of" - can it ignore blanks
    By nigelog in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-24-2014, 09:33 AM
  5. [SOLVED] Counting data only contains text (ignore mark "-" & "")
    By Jhon Mustofa in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-12-2014, 09:45 PM
  6. Replies: 5
    Last Post: 10-12-2010, 06:46 AM
  7. VB Macro for Proper Case to Ignore "/" & "-"
    By jlcford in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2008, 07:49 AM

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