Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6664609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:37:47+00:00 2026-05-26T02:37:47+00:00

I am trying to program a simple loop to run through the user selected

  • 0

I am trying to program a simple loop to run through the user selected values and filter out some number display and the numbers I want in a different column.
I have 10 random numbers in a column in this order:

3
7
10
12
5
2
7
13
9
23

I essentially want to ignore the first value, retrieve the next two values, skip the fourth
value, retrieve the next two values and so on. So my output would be:

7
10
5
2
13
9

All I have is a loop that runs through the column. I think I would have to use the mod() function but I can’t sem to get it right. All I have so far is this empty loop:

Sub findValues()

Do While Cells(x, 3).Value <> "" 'go through values in column 3 until empty cell is encountered
    'skip first value
    'retrieve next two values and put them in different column
    '...
Loop

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:37:48+00:00Added an answer on May 26, 2026 at 2:37 am

    Here’s one solution to do it using a loop and Step 3.

    It’s not the fastest or optimized way, but it’s one of many methods that works and this method is rather simplistic. The example assumes that the data is in column A and the new list will be output to column B.

    Since you want to skip the first value, I start the loop at A2, then do a Step 3 each loop (but copy over 2 elements, so it’ll always skip the 3rd element).

    Sub test()
    
    Application.ScreenUpdating = False
    Dim i As Long, j As Long
    Dim lastRow As Long
    
    lastRow = Cells(Rows.Count, 1).End(xlUp).Row
    j = 1
    
    For i = 2 To lastRow Step 3
        Cells(j, 2).Value = Cells(i, 1).Value
        Cells(j + 1, 2).Value = Cells(i + 1, 1).Value
        j = j + 2
    Next
    
    Application.ScreenUpdating = True
    End Sub
    

    Note that using Cells(row, column) is better for looping than Range() notation (and faster, too).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a very simple program, I want to print out the
I am writing a simple program, which is trying to find next palindrome number
I'm just starting out writing trying to write a simple program in C and
During program optimization, trying to optimize a loop that iterates through a vector, I
I am trying to make a simple calculator program where a user can opt
I was trying to make a simple bubblesort program. Read in numbers from a
I'm trying to write a simple program in VC++ which will just initialize the
I'm trying to compile a simple program, with #include <gtkmm.h> The path to gtkmm.h
I am trying to write a simple program to open a socket channel to
I'm trying to get this simple program to work on windows, but it crashes:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.