+ Reply to Thread
Results 1 to 12 of 12

Problem with compound IF statement

  1. #1
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Question Problem with compound IF statement

    Here's what I'm trying to say:

    If column A is greater than 0, then sum column J if J is greater than 0.

    My data download is generally 500-700 rows, so I'm using 1000 to capture all data. However, my data has repeating headers with text and Excel seems to treat that as greater than 0 also.

    I do have a unique date range field in column E that I can use (in MM/DD/YYYY format) to say if it's greater than 01/01/1900 , but I couldn't get that to work either.

    Any help would be appreciated.
    Thanks,
    Phillycheese5

  2. #2
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    Maybe try this:

    IF(AND(columnA>0, columnJ>0, ISNUMBER(columnA), ISNUMBER(columnJ)), SUM(columnJ),"")


    Hope it helps.


    Quote Originally Posted by Phillycheese5
    Here's what I'm trying to say:

    If column A is greater than 0, then sum column J if J is greater than 0.

    My data download is generally 500-700 rows, so I'm using 1000 to capture all data. However, my data has repeating headers with text and Excel seems to treat that as greater than 0 also.

    I do have a unique date range field in column E that I can use (in MM/DD/YYYY format) to say if it's greater than 01/01/1900 , but I couldn't get that to work either.

    Any help would be appreciated.
    Thanks,
    Phillycheese5

  3. #3
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223
    Morrigan,
    I did get a number with your formula (I substituted "A:A" for "columnA" and so on) but the result did not tie to what I did manually......
    Mabye using the date field is a better way to go???
    Phillycheese5

  4. #4
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    What can be contained in Column A & J?

  5. #5
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223
    Column A is shares, and column J is either realized gains (positive) or losses (negative). The problem is that I have header rows which repeat throughout the spreadsheet. But none of the headers have numbers in column A, so that's why I chose it to use if it was greater than zero...

  6. #6
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    Is the header rows there for a purpose? Can it be taken out and just freeze panel to keep one header rows and use "print repeat top rows" for printing?


    Quote Originally Posted by Phillycheese5
    Column A is shares, and column J is either realized gains (positive) or losses (negative). The problem is that I have header rows which repeat throughout the spreadsheet. But none of the headers have numbers in column A, so that's why I chose it to use if it was greater than zero...

  7. #7
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    I just looked at my formula and I realized the problem. Sorry about that. Do this instead and you need a helper column because you cannot just apply SUM() inside an IF statement.

    ColumnK = IF(AND(columnA>0, columnJ>0, ISNUMBER(columnA), ISNUMBER(columnJ)), J,"")

    Now apply SUM(K:K)

  8. #8
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223
    The dataset is a download from a program that doesn't allow me flexibility with the text headers, and is not at regular intervals since the length of the dataset varies and it has subtotal lines along the way. The only unique fields is the shares in column A (as an integer) and the date (in column E) as MM/DD/YYYY.

  9. #9
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223
    I tried the formula with the helper column and still couldn't get it to work...not sure why...

  10. #10
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    It worked for me. Here is what I tried:

    Header Header Helper
    4 5 5
    6 -6
    -7 7
    Header Header
    8 -8
    9 9 9


    SUM() = 14


    What kind of result are you getting?





    Quote Originally Posted by Phillycheese5
    I tried the formula with the helper column and still couldn't get it to work...not sure why...

  11. #11
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Thumbs up

    Okay, got it!
    I didn' t know that the J at the end of the formula needed numbers identifying it to a cell (I thought it was some other reference).
    Thanks,
    Phillycheese5

  12. #12
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    Glad it worked.


    Quote Originally Posted by Phillycheese5
    Okay, got it!
    I didn' t know that the J at the end of the formula needed numbers identifying it to a cell (I thought it was some other reference).
    Thanks,
    Phillycheese5

+ 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