+ Reply to Thread
Results 1 to 6 of 6

Macro Loop with What If function

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    Maastricht, Netherlands
    MS-Off Ver
    2010
    Posts
    4

    Macro Loop with What If function

    Hi Guys

    I have a problem for my Master thesis. I have been downloading tweets for the past 3 month and now im trying to get them into order.
    the columns are in the following order:
    1) ID = A
    2) Username = B
    3) Date = C
    4) Time = D
    5) Status = E

    As i imported the tweets into Excel the Status got messed up when somebody hit Enter in his/her tweet. Then the part after the Enter-sign got inserted into the next row in column A (ID)

    I therefore created a Macro that joined the Status with the next rows column A. See here:

    Please Login or Register  to view this content.


    Also if somebody hit Enter twice a blank row occurs in between the actual tweets. I also created a Macro for that:

    Please Login or Register  to view this content.


    This all works out fine if i do it manually. HOWEVER, there are almost 100.000 tweets and if i go through all of them it will take me days.
    I want to create a loop that starts in column A and goes through. Everytime there is no number in a cell it should check whether the cell is empty and use the second macro or whether it has some other things in it (mostly text) and use the first macro.

    I dont have any idea how to do this. can somebody help? I 'd appreciate it a lot!!
    Last edited by arlu1201; 06-05-2013 at 05:55 AM. Reason: Use code tags in future.

  2. #2
    Registered User
    Join Date
    06-05-2013
    Location
    Maastricht, Netherlands
    MS-Off Ver
    2010
    Posts
    4

    Re: Macro Loop with What If function

    If two What if functions are too much, it would be awesome just to use the first macro in the loop! the second macro is not so important because it would just add another space in between text.

    I hope somebody can help out me here! It'd save me like 2 days of stupid work!

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro Loop with What If function

    Can you upload an workbook with an example of the data, it should be simple but I don't know what twitter ID's look like to determine whether the cell in column A is an ID or a status. It would probably be easier to determine if it is an ID rather than if it is a status as I woudl assume they would look more consistent.

  4. #4
    Registered User
    Join Date
    06-05-2013
    Location
    Maastricht, Netherlands
    MS-Off Ver
    2010
    Posts
    4

    Re: Macro Loop with What If function

    Sure, here is a sample
    Thanks so much!
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro Loop with What If function

    Please Login or Register  to view this content.
    That works for your sample.

    Edit: actually it will get stuck eventually. put "End of tweets" in the last row and then use this instead:
    Please Login or Register  to view this content.
    Last edited by ragulduy; 06-05-2013 at 07:14 AM.

  6. #6
    Registered User
    Join Date
    06-05-2013
    Location
    Maastricht, Netherlands
    MS-Off Ver
    2010
    Posts
    4

    Re: Macro Loop with What If function

    Thanks so much!

    It took a little longer than for 30 tweets but it worked perfectly without any human mistakes!
    You my friend saved me hours and hours of work! Appreciate it a lot!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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