+ Reply to Thread
Results 1 to 5 of 5

IF false go to next cell and repeat (loop)

  1. #1
    Registered User
    Join Date
    04-29-2016
    Location
    California, USA
    MS-Off Ver
    2013
    Posts
    2

    IF false go to next cell and repeat (loop)

    Hello I am new to this forum so I hope I do this correctly.

    I am needing help with a problem. I am a novice at VBA so I am hoping to accomplish my task with a formula.

    I need to track breaks and lunches at work for employee's. I want to know if there is a way to write an if statement that will go to the next cell if the statement returns false.

    I basically want to have a blank page with a formula that will pull data from another page but only if the person worked that day.

    so what I have is this

    =IF([formula.xlsx]TimeQey!$A1="worked",[formula.xlsx]TimeQey!$B1)

    But then I have a page full of false. How can I only return the data for cells where the value is worked?

    I need something that says if value is 'false' or 'off' then skip and go to next cell


    Thank you

    Terri

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF false go to next cell and repeat (loop)

    Every IF has 3 parts.
    1) An expression evaluating a True or False condition
    2) What to do if the expression is TRUE
    3) What to do if the expression is FALSE

    =IF(condition, dothisifTRUE, dothisifFALSE)

    The 3rd option is actually optional, but if it's omitted and the expression is FALSE, then the IF simply returns FALSE

    You just need to tell the formula what to do if the expression is FALSE

    =IF([formula.xlsx]TimeQey!$A1="worked",[formula.xlsx]TimeQey!$B1,"")

  3. #3
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: IF false go to next cell and repeat (loop)

    You're nearly there.

    You can leave the cells blank where the value in cell A1 is not "worked" by slightly changing your formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Excel is a constant learning process and it's great to help each other. If I've helped you today, a click on the star on the left is appreciated.

  4. #4
    Registered User
    Join Date
    04-29-2016
    Location
    California, USA
    MS-Off Ver
    2013
    Posts
    2

    Re: IF false go to next cell and repeat (loop)

    I am pulling back hundreds of employee's breaks. I don't want empty cells either. Is there a way for it to just skip that row if it is false?

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF false go to next cell and repeat (loop)

    Are you saying that
    =IF([formula.xlsx]TimeQey!$A1="worked",[formula.xlsx]TimeQey!$B1)
    If A1 does NOT = worked, then 'In the same formula' check A2, if that is worked, then return B2 ?

    Try
    =VLOOKUP("worked",[formula.xlsx]TimeQey!$A$1:$B$1000,2,0)

+ 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. Repeat or Loop VBA Statements
    By zede35 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2014, 03:19 AM
  2. Replies: 4
    Last Post: 03-08-2014, 08:01 AM
  3. [SOLVED] Loop or Next Repeat
    By namluke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2014, 07:46 AM
  4. VBA Loop, Find, Copy, Repeat Loop
    By sparx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2013, 06:25 AM
  5. [SOLVED] Repeat actions in a Loop
    By abduljaleel.mca in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 11:03 AM
  6. Loop/Repeat macro..
    By artfulrodger in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2010, 07:50 AM
  7. Loop/Repeat smallscroll
    By criswilk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2007, 02:00 AM

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