+ Reply to Thread
Results 1 to 3 of 3

Trying to complete Advent of Code 21 in Excel [D2/P2]

  1. #1
    Registered User
    Join Date
    12-09-2021
    Location
    Czechia
    MS-Off Ver
    365
    Posts
    1

    Post Trying to complete Advent of Code 21 in Excel [D2/P2]

    Input:
    forward 5
    down 5
    forward 8
    up 3
    down 8
    forward 2
    etc...


    Where:
    down X increases your aim by X units.
    up Y decreases your aim by Y units.
    forward Z increases your depth (your current aim multiplied by Z).


    Result:
    forward 5 -> Because your aim is 0, your depth does not change.
    down 5 -> adds 5 to your aim, resulting in a value of 5.
    forward 8 -> Because your aim is 5, your depth increases by 8*5=40.
    up 3 -> decreases your aim by 3, resulting in a value of 2.
    down 8 -> adds 8 to your aim, resulting in a value of 10.
    forward 2 -> Because your aim is 10, your depth increases by 2*10=20
    Depth = 60


    I need to track Aim and depth (z*aim) in top to bottom order (because of the multiplication).
    I tried many things but i looks like i'll need custom function, unless anyone has any ideas.
    If someone wants to try as well: adventofcode.com/2021
    Last edited by LilGanja1337; 12-09-2021 at 01:38 PM.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Trying to complete Advent of Code 21 in Excel [D2/P2]

    B1: horizontal
    C1: depth
    D1: aim
    B2: 0
    C2: 0
    D2: 0

    Paste the input for the puzzle into A3:A1002. Then:

    Please Login or Register  to view this content.
    Copy B3:D3 to B4:D1002.

    Multiply B1002 * C1002 to get the answer.

    WBD
    Attached Files Attached Files
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,021

    Re: Trying to complete Advent of Code 21 in Excel [D2/P2]

    The first version of the User Defined Function in this workbook needs to be array-entered (entered using Ctrl-Shift-Enter) into 2 adjacent cells, either in one row or in one column.

    The second version returns values to other VBA code.
    Attached Files Attached Files
    Last edited by Bernie Deitrick; 12-09-2021 at 01:26 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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] Step within Macro is taking forever to complete and locks up excel until complete
    By cubangt in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 05-16-2017, 11:58 AM
  2. Need a code to only continue to another VBA if cells are complete.
    By k1989l in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-05-2015, 07:32 AM
  3. Replies: 4
    Last Post: 06-28-2014, 10:08 AM
  4. Help me complete this copy paste code
    By booost in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-15-2012, 09:02 AM
  5. Wait for the code to execute before complete opening of excel
    By camaytoc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-06-2012, 09:59 AM
  6. Macro code error: code is near complete
    By kashshaikh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2011, 03:22 PM
  7. Reading complete Excel using DDE code
    By amitkrsingh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2005, 10:05 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