+ Reply to Thread
Results 1 to 6 of 6

How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in Excel

Hybrid View

  1. #1
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in Excel

    How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in Excel?

    Thank you for your help in advance!

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,907

    Re: How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in E

    What is the "rule" for the pattern? If I follow correctly, the rule is:

    0) Start with seed value.
    1) Add 1
    2) subtract 1
    3) add 1
    4) add 1
    5) Go to step 1

    Here's how I would implement the above algorithm in a spreadsheet.

    1) Enter my seed value in my desired starting cell. I chose A3. In A2 I enter "seed" to remind me what is supposed to go in A3.
    2) In row 2, I will enter the desired value to add at each step.
    2a) In B2, I enter 1.
    2b) In C2, I enter -1.
    2c) In D2, i enter 1
    2d) In E2, I enter 1.
    2e) From here, I am just repeating the values, so I enter =B2 into F2, and copy/paste/fill across as far as I want the series to exist.
    3) Calculate the series in row 3. In B3, I enter =A3+B2. Copy/paste/fill across as far as I want.

    Does something like that work for you? What works and what doesn't work?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in E

    The first 4 values set a pattern. In the diagram below, A1:A4 are entered manually. In A5, enter this formula:
    Formula: copy to clipboard
    =A1+2
    and drag down as far as required.

    Row\Col
    A
    1
    1
    2
    2
    3
    1
    4
    2
    5
    3
    6
    4
    7
    3
    8
    4
    9
    5
    10
    6
    11
    5
    12
    6
    13
    7
    14
    8
    15
    7
    16
    8
    17
    9
    18
    10
    19
    9
    20
    10
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  4. #4
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    Re: How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in E

    I believe your approach is easier but I'm not allowed to enter values manually for the first 4 rows. I really appreciate your help though!

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in E

    Hi zzxxclc and welcome to the forum,

    How about a formula in the first cell and pull it down? Try this formula.
    Formula: copy to clipboard
    =ROUNDUP(ROW()/4,0)+IF(ISEVEN(ROW()),1,0)+INT((ROW()-1)/4)

    in the attached:
    Two Step Counts.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Registered User
    Join Date
    05-09-2023
    Location
    New York, NY, USA
    MS-Off Ver
    Not sure
    Posts
    9

    Re: How can I generate numbers in patterns such as 1,2,1,2,3,4,3,4,5,6,5,6,7,8,7,8... in E

    It worked! Thank you so much for your help

+ 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. [SOLVED] generate all formations of each of the 64 pick3 patterns.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2022, 12:26 PM
  2. Finding patterns in a list of numbers for EXCEL spreadsheet
    By Herotrader in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2018, 04:42 PM
  3. Excel - generate random numbers
    By whitetea in forum Excel General
    Replies: 5
    Last Post: 05-26-2012, 01:12 PM
  4. Need Excel to generate numbers and mix them
    By Johncobb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2009, 02:05 PM
  5. [SOLVED] How do I automatically generate numbers in Excel-Ex:1,2,3
    By Anne in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2006, 11:05 AM
  6. How do I Automatically generate numbers in Word or excel
    By Dave W in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2005, 11:05 AM
  7. How do I generate random lottery numbers in Excel?
    By Mark1809 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM

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