+ Reply to Thread
Results 1 to 5 of 5

Proper syntax for IF statement within macro

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    7

    Red face Proper syntax for IF statement within macro

    Another user generously shared this with me which sums up values in multiple columns and puts the summation in the first empty cell found. The number of values (rows) will vary each time. It works great but I now have another problem that I am hoping that can be added to this routine for simplicity but if another routine can do it, that is great too. Because the rows vary I thought it might make sense to just evaluate the sums at the same time but not certain! The description of my problem is below the routine.

    Please Login or Register  to view this content.
    Can I do an evaluation of the results and have it insert text in the next empty column cell (in the same row) based on the results? So if the results are in A4, B4 and C4, the text would appear in D4

    For example, if the results show
    8 5 0
    it would return
    8 5 0 NIGHT

    I think the conditions I need look like this:

    if column B value is not null insert NIGHT
    if column B value and C value are 0 and A is not null insert DAY
    if column A value and B value are 0 and C is not null insert ONLINE

    I would appreciate any help someone can offer!
    Last edited by jeffreybrown; 10-30-2012 at 11:25 PM. Reason: Code tags please.

  2. #2
    Registered User
    Join Date
    10-29-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: help needed - If statement routine

    I think statement works but I need it to just evaluate the rows with the sums completed in the above routine NOT all of the rows. Please help in any way possible. Many thanks!

    =IF(P6<>0,"NIGHT",IF(AND(P6=0,N6<>0),"DAY",IF(AND(N6=0,P6=0,R6<>0),"ONLINE")))

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: help needed - If statement routine

    Try this...

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-29-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: help needed - If statement routine

    This seemed to work fine. Thanks so much for your expertise and your time!

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Proper syntax for IF statement within macro

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    HTH
    Regards, Jeff

+ 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