+ Reply to Thread
Results 1 to 2 of 2

How can I replace a duplicate value with the next valid entry?

  1. #1
    Registered User
    Join Date
    01-13-2023
    Location
    Quebec
    MS-Off Ver
    v16.0
    Posts
    2

    How can I replace a duplicate value with the next valid entry?

    Hello,

    I recently started Excel and to learn it I challenged myself to make a game.
    The game is a turn-based strategy with actors using their speed value to know in what order they should play during the current turn.

    The problem I'm trying to solve right now is the edge case of speed ties; multiple actors sharing the same speed value.

    I currently have a first table where I store the final sum of each speed value per actors, I called that specific part of the table Speed_Used.
    My 4 actors are grouped under the name Math_Targets.

    Next to it, I have a second table with 4 positions (4 cells).
    Here I store the speed values from highest to lowest like this (grouped under the name SpeedPositions_Numbers):
    P1: =MAX(Speed_Used)
    P2: =LARGE(Speed_Used,2)
    P3: =LARGE(Speed_Used,3)
    P4: =MIN(Speed_Used)

    Right under this, I'm placing my actors' name below their speed value with this formula =XLOOKUP(SpeedPositions_Numbers,Speed_Used,Math_Targets).

    So in the context of a speed tie, I'm getting the first actor's name that match with the speed value multiple times.

    I read and tried a bunch of stuff, like: TEXTJOIN, COUNTIF, INDEX, MATCH, but so far I didn't managed to solve my problem on my own.
    I'm not looking for the most fair play game design wise solution (but I also don't want to hack it); right now I would be happy if I could simply get the next valid name in line to take place in my position table.

    Any help would be appreciated.
    Thank you.
    Last edited by EpilepsY; 01-17-2023 at 04:32 PM.

  2. #2
    Registered User
    Join Date
    01-13-2023
    Location
    Quebec
    MS-Off Ver
    v16.0
    Posts
    2

    Re: How can I replace a duplicate value with the next valid entry?

    Found a solution; using the SortBy function instead of the XLOOKUP.

+ 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. previously valid formulas become invalid as entry is made
    By robvasi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-16-2021, 02:06 PM
  2. VBA to mass replace UNICODE symbols to valid values
    By Vixx1 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-28-2020, 09:31 AM
  3. macro to check valid ticket entry
    By collirde in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2016, 01:31 AM
  4. Call Macro if not Valid Entry is Used in a Data Validation Field
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2015, 08:19 AM
  5. Keeping the cursor in a cell to ensure a valid entry is made
    By ReportBuilder2011 in forum Excel General
    Replies: 3
    Last Post: 05-31-2011, 07:05 PM
  6. Msgbox to test for valid entry B-4 continuing
    By 54Libra in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-14-2007, 03:28 PM
  7. Checking for valid dates on entry
    By Ian in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2005, 01: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