+ Reply to Thread
Results 1 to 34 of 34

Complex If Statement

  1. #1
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127

    Complex If Statement

    Ok, I have a fairly complex (and probably unsophisticated) if then statement.

    It worked on one row, but when I copied it down, it didn't seem didn't work anymore.

    I'm confused by it, it's fairly long, and I'm not sure where the problem is... I've included an example, but I have to copy this down for 1000 rows, so I need that functionality.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    i just realized I had it saved as a 2007 file, and was going to convert it back to 2003 for everyone, however it said my formulas were too long to do that... is there a cleaner way to accomplish the same task?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Rather than us having to figure out what you intended with a formula that doesn't work, maybe you could explain?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    sorry, it seems as if thethe first row of it works, and the rest when copied down, doesn't.

    there are 3 seperate areas, and they take an order of importance as follows:

    1. Payment Plan Schedule
    2. Promised Pay Date
    3. Invoice Due Date

    Each one of these is basically an escalation in the accounts payable procedure. There are 4 "Payment Plan" dates that can be entered, as well as a monetary amount. These should be reflected in the weeks on the right. The "Promised Pay" date should do the same, and the Invoice Due Date, last.

    So, if there is nothing for a date or amount in the payment plan, it would revert to the promised pay date, and if nothing in that then to the invoice date.

    *** first thing it would do is check to see if it has been "x" for paid, of course.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Robert,

    I don't have Excel 2007 on this computer, and am away from my home computer for a few days. (I assume your formulas exceed the nesting depth of 2003?)

    My one suggestion is that you might add one or more hidden helper columns that simplify the formula that appears in the cell (and maybe make the formula a little more maintainable).

  6. #6
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    I'm assuming so also (for the conversion of 2007 - 2003), There are 6 cells to check for data against changing cells to check date.and it needs to roll forward by using a copy past function.

    I do think that the top row is right, but when I copy and past it across, it doesn't work.... And, I'm not sure if anyone here has a trick to try and edit long formulas easily?

    I tried word, but without the colored groupings that was hard.... I'm sure i screwed up something simple like a $ on a cell definition, but i can't quite seem to find it.

  7. #7
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi Robert,

    Post the text of the formula & we can have a go at finding the problem just from a quick visual check. I only have Excel 2003 & so am only used to the nesting of 7 statements, however I'll give it a shot...

    (I'm building up some credit for when I may ask for some suggestions from you ;-))

    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  8. #8
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111
    G'day NZ Rob,

    Best of luck

    Please Login or Register  to view this content.
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

  9. #9
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    Thanks Ratcat, the luck will be needed, that's for sure!

    Robert,
    First up, 2 sets of brackets can be removed (ie"(if" is not needed nor are the corresponding closing bracket) this changes it from
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Other than that, almost everything looks consistent (eg in terms of referencing technique) except...
    for the last section which tests to see if I13 is greater than zero + performs an And test & then breaks the "convention" of grabbing the next column as a result because it references $E13 (conventon suggests the resulting cell should be in column J (ie offset by one column)).

    past my bed-time, good luck!
    Rob

  10. #10
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    hey rob,

    thanks for reviewing it... without seeing the actual worksheet, it would be difficult for you to see... i13 wasn't supposed to follow that same grab the next column pattern, it references a full amount for the invoice.

    so...

    this is still unsolved for me... i can't seem to figure out the issue.

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    well doing it blind i cant see where its supposed to go in the worksheet
    Please Login or Register  to view this content.
    it may be total rubbish as i dont know what its supposed to do!

  12. #12
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    martin, can you view the workbook?

    This formula is for a cashflow model to view incoming and outgoing cash on a weekly basis.

    there are 3 different ways that a payment date can be calculated.

    1. Based on the invoice due date
    2. Based on the day I actually EXPECT them to pay
    3. Based on a payment plan (with a maximum of 4 payments)

    since each of those is an escalation over the last, the formula checks if there is a date in 1 of the 4 sections of the payment plan. then if there is a date, and it is within the current weeks date, it returns the value. if it isn't within the current week, it returns nothing. then it checks the expected pay date, if it's within the current week range, it returns the full invoice value, if there isn't a date in the expected category, it checks the due date and if it is within the current range, it returns the full invoice amount.

  13. #13
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    here's a copy saved as a 2003 format....

    obviously it gave me a major error because of the length of the formulas.

    but... i thought this way you might get the visual.
    Attached Files Attached Files

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    what cell is it in?

  15. #15
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    my problem is that it works on the first row, but when i copy it across and down it doesn't anymore.

    from cells v13 across to at13, and then down 1000 rows.

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    if you did this manually what totals would you expect in
    v,w,x,y 18?

  17. #17
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,629
    An option would be to replace the "=" in the 2007 sheet and have the formulas appear a text in a sheet just for the forum to look at...
    Ben Van Johnson

  18. #18
    Registered User
    Join Date
    01-24-2007
    Location
    Melbourne, Australia
    Posts
    79
    Hi, I think I found your problem. There is no data in the payment plan section (except for the first row) when I copied cells L13-T13 down a row, your formula worked.
    Hope this helps
    Jase

  19. #19
    Registered User
    Join Date
    01-24-2007
    Location
    Melbourne, Australia
    Posts
    79
    Was I right, or were you looking for something else?

  20. #20
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949
    DOH!
    Sorry dude, I have 2007, I looked at this much earlier and couldn't figure out how it worked so I kinda walked away from it.
    ><
    me sry.

    Your formula works, you just need to enter an if statement for the cells with regard to reference cells being blank! It says "FALSE" because none of the arguments you have allowed for are being met. IE if it's this, do this, if it's that, do that, but if it's blank, none of the arguments are true, so it's showing "FALSE"

    I guess Jason figured that out before me. ><

  21. #21
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    hmmm... ok, i think this does have something to do with conditions not being met, but i am not quite sure still (sorry, i have been away from this problem for a while)

    Columns L, N, P, R - are the first sets of dates that it is supposed to look for. If these don't exist, it should then use the dates in Column I, and if there isn't one in that column, it should use Column H, then, if none of those conditions exist, it should display blank.

    i've going through it again, hopefully i can figure it out.

  22. #22
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Okies

    Do you have a more recent version of it which you've updated at all or still the original?
    I remember looking at this before and not being entirely clear on what your if statement is meant to do. One question though, is it necessary to have the same formula in every cell? It looks as though each of these columns is meant to reference a specific column elsewhere, for example, W and X, M and O, Is there a reason you're trying to build a single if statement for all of them at once? It looks like you could write one for each column and copy them down...?
    Last edited by mewingkitty; 12-05-2008 at 06:36 PM. Reason: Cause I overthink my posts.

  23. #23
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    nope, still the original... everytime i do something to it, and copy it across, if it doesn't work, then i go back to the start... i think things can get off track really fast revising and revising, etc.

  24. #24
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949
    Here's a thought... looking at this on paper in logical statements...
    You start with
    IF($R13>0,IF(AND($R13<=W$8,$R13>V$8),$S13
    Now this says
    if r13 is greater than 0
    then continue on to see;
    ifr13<=w8
    and
    if r13>v8
    then s13
    You then carry on to the next cell, P, then to N, then to L

    Problem I can see in the logical argument on paper, is that you have 2 if statements for R13, yet you jump immedietly into the next group for P while only reconciling one of the "If not" criteria. What I mean to say is that I think it's going from

    ifr13<=w8
    and
    if r13>v8
    then s13
    if not, then if P ... etc, etc...
    But the original if R13>0 does not have a - If not - to close it.

    I'm not sure if that's the problem you're having in excel, but I do know that looking at it on a page written the way I've typed it out, it's obvious that for each if statement, you need a if not statement, and only one is offered for each group.

    So...
    If R13<=w8
    and
    R R13>V8
    then S13
    if not........

    There's the argument I think you're missing in each group.
    At least it's the one that I can't figure out what is supposed to be.

  25. #25
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Meh?

    I changed your formula slightly so that each group of if's referring to a single cell are individually nested in order to get rid of the FALSE problem you've had. Check out the attached worksheet and see if it's what you're looking for.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  26. #26
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    1 thing...

    It seems to reference the expected date as well as the due date? So it shows payments on dates for both of them, doubling some of the items. Not sure which one you want to go with. Shouldn't be too far off with that information of making this 100% functional. We'll get this done soon enough.

    Should be able to have it choose one or the other based on which is sooner/later depending on what you need, and have it only reference that one... I think. I'm not at a comp with excel 2007 right now so I can only look at it.

    Let me know though, or if you get this figured, post it, It'd be good to know that you got it up and running, you've been working on this for a while.
    Last edited by mewingkitty; 12-06-2008 at 04:43 PM. Reason: Cuz i r a kitty.

  27. #27
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    1 thing...

    Could someone delete this plz, hit the post button twice.
    Last edited by mewingkitty; 12-06-2008 at 04:30 PM. Reason: I have the dumb.

  28. #28
    Registered User
    Join Date
    01-24-2007
    Location
    Melbourne, Australia
    Posts
    79
    Sorry, please delete this post
    Last edited by jasonmcbride; 12-07-2008 at 07:38 PM. Reason: Misread a previous post

  29. #29
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    mmmMMM!?

    Only thing left is if there's a payment planned date which is sooner than the due date, it lists them both. Not sure how that affects your end of things.

    Please Login or Register  to view this content.
    See attached.
    Attached Files Attached Files
    Last edited by mewingkitty; 12-08-2008 at 05:18 PM. Reason: Done, methinks

  30. #30
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    ok... sorry again... it was my birthday, so i was taking an excel vacation.

    so, if a planned payment date is before the due date it shows both.... hmmm... i hadn't thought of this before... companies don't usually pay in advance... but, if it happens, the planned date should over ride the due date... since it was a manually entered number, and not a function of the invoice date plus the terms.

  31. #31
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    One more time!

    Got that resolved.

    Last issue conceivable ( hate to say that, cause now there'll be others )

    Is this possible -

    No bill date,
    no plan to pay date,
    yet...
    a payment it posted with a date.

    I really think that if they post it, a planned to pay date should be posted along with it, but I'm not the one who has to use the thing, so lemme know!

    I believe we've now covered - planned date before bill date, no planned date, no due date.
    Attached Files Attached Files

  32. #32
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949
    Eh, I know this shows three pages, and i posted my final draft on the third page, but can't seem to see it? Wherefore did my poor little post go?

    Edit:
    Weird, pops up now.
    Last edited by mewingkitty; 12-12-2008 at 03:38 PM. Reason: Pancakes.

  33. #33
    Forum Contributor
    Join Date
    06-29-2008
    Location
    Grand Rapids, MI
    MS-Off Ver
    Office 2010
    Posts
    127
    there will always be an bill date put into the system. The planned to pay date may or may not be entered... if a check is received before it was expected, it wouldn't have one.

    The planned pay date is entered when a company has to call and say "hey, when are you planning on paying me?"

  34. #34
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    OOOOooooook

    Lets see if I got it right this time.

    - if there is a payment date anywhere, it takes those into account and posts them, ignoring the planned pay and other dates.

    - if no payment date is present, it takes the planned pay date as the date on which the full amount will be paid.

    - if no payment date or planned date is present, it takes the due date as the date on which the full amount will be paid.

    - if no payment date, planned date, or due date is present, it takes the bill date as the date on which the full amount will be paid.

    - if a unladen african swallow is heading east at 34 kilometers an hour, how long will it take my brain to melt if I keep missing things on this sheet?



    mew!

    Edit:
    I did miss something, should be fixed now.
    That's a lot of conditions man :P

    Edit edit:
    Forgot to include =< for the billing dates

    Edit edit edit:
    Added the column in the left to include all dates 2 weeks prior to that billing date.
    Attached Files Attached Files
    Last edited by mewingkitty; 12-12-2008 at 09:57 PM. Reason: edit.

+ 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