+ Reply to Thread
Results 1 to 11 of 11

My IF, And, Relative Failure

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    home
    MS-Off Ver
    Excel 2010
    Posts
    6

    My IF, And, Relative Failure

    I have 1 sheet with 11000 rows of data, most of which I don't need.

    Column B contains years (2006, 2007, 2008 etc), while Column D contains a large text string. Column G contains a weight in kilograms.

    I am trying to reference this sheet to pull out the data I need (kg).

    Here is my failed attempt at a formula to do so:

    =IF(AND(Sheet3!B$1=2007, Sheet3!D$1="Coal"),Sheet3!G$1,"Nothing")

    Each year will have a different text string and kg amount in it's row. I'm simply trying to make a formula that states if the row contains 2007 AND Coal, use that row's KG value. This formula works:

    =IF(AND(Sheet3!B26=2007, Sheet3!D26="Coal"),Sheet3!G26,"Nothing")

    But I need Excel to automatically find the rows and data for me.

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: My IF, And, Relative Failure

    You could use INDEX and MATCH

    Howevr, do you have a subset of your data you can post?
    Click on star (*) below if this helps

  3. #3
    Registered User
    Join Date
    08-24-2012
    Location
    home
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: My IF, And, Relative Failure

    Please Login or Register  to view this content.
    Something like this.

    If B* = 2008 And D* = "Mineral waxes nes", then G2 would be the result.

  4. #4
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: My IF, And, Relative Failure

    It would be better if it were already in Excel format rather that text

  5. #5
    Registered User
    Join Date
    08-24-2012
    Location
    home
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: My IF, And, Relative Failure

    Example.xlsx

    Alright, so...

    Sheet 1, F7. I need it to display 120474 from Sheet 3, G2. It needs to see that this data (120474) is from 2008 and for "Bitumen and asphalt, asphaltites and asphaltic rocks".

    This is a very small section of the data. There are dozens of years and other countries will have all of the different energy types.

    Sorry if this is difficult to understand, it's hard to explain.

  6. #6
    Registered User
    Join Date
    08-24-2012
    Location
    home
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: My IF, And, Relative Failure

    Quote Originally Posted by K m View Post
    You could use INDEX and MATCH

    Howevr, do you have a subset of your data you can post?
    I research this some more and was able to get my formula to do what I wanted with:

    =INDEX(Sheet2!G2:G12000,MATCH(1,(Sheet2!A2:A12000="Anguilla")*(Sheet2!B2:B12000="2008")*(Sheet2!D2:D12000="Coal briquettes, ovoids, similar made solid fuels"),0))

    I am trying to implement ISERROR to remove the N/A values that arise from some countries not having the same amount of data as others, but I cant seem to figure it out.

  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,726

    Re: My IF, And, Relative Failure

    You just put ISERROR around all of that, like this (in red):

    =ISERROR(INDEX(Sheet2!G2:G12000,MATCH(1,(Sheet2!A2:A12000="Anguilla")*(Sheet2!B2:B12000="2008")*(Sheet2!D2:D12000="Coal briquettes, ovoids, similar made solid fuels"),0)),"")

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    08-24-2012
    Location
    home
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: My IF, And, Relative Failure

    Quote Originally Posted by Pete_UK View Post
    You just put ISERROR around all of that, like this (in red):

    =ISERROR(INDEX(Sheet2!G2:G12000,MATCH(1,(Sheet2!A2:A12000="Anguilla")*(Sheet2!B2:B12000="2008")*(Sheet2!D2:D12000="Coal briquettes, ovoids, similar made solid fuels"),0)),"")

    Hope this helps.

    Pete
    That one says "You have entered too many arguments for this function" and highlights the double quotes at the end.

  9. #9
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: My IF, And, Relative Failure

    why not use IFERROR your in xl 2010 right?
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

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

    Re: My IF, And, Relative Failure

    Sorry, it should be IFERROR:

    =IFERROR(INDEX(Sheet2!G2:G12000,MATCH(1,(Sheet2!A2:A12000="Anguilla")*(Sheet2!B2:B12000="2008")*(Sheet2!D2:D12000="Coal briquettes, ovoids, similar made solid fuels"),0)),"")

    Hope this helps.

    Pete

  11. #11
    Registered User
    Join Date
    08-24-2012
    Location
    home
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: My IF, And, Relative Failure

    Quote Originally Posted by vlady View Post
    why not use IFERROR your in xl 2010 right?
    Changing IS to IF fixed it, thanks!

    ---------- Post added at 08:48 PM ---------- Previous post was at 08:47 PM ----------

    Quote Originally Posted by Pete_UK View Post
    Sorry, it should be IFERROR:

    =IFERROR(INDEX(Sheet2!G2:G12000,MATCH(1,(Sheet2!A2:A12000="Anguilla")*(Sheet2!B2:B12000="2008")*(Sheet2!D2:D12000="Coal briquettes, ovoids, similar made solid fuels"),0)),"")

    Hope this helps.

    Pete
    Thanks Pete.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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