Excel: referencing a table cell

2

In Excel I have a table, with the first column acting as a unique identifier (I make sure there aren't duplicates). I want to be able to reference a cell of this table's first column so that: - if I change the value of a referenced cell, the references get updated automatically as well - if I change the table sorting, the references to a cell with a certain value keep reference to the cell with that value

Is it even possible in Excel without using VBA? Thank you in advance.

More details on my specific case

I'm designing a turn-based battle game, in which characters have different attacks. I've got an Attacks table with the following columns:

  • Attack name
  • Type
  • Target Mode
  • Cost
  • Power
  • etc...

The Attack name column contain unique values: I use it as a unique identifier for each attack.

Then I have a Characters table, with the following columns:

  • Name
  • Max HP
  • Strength
  • (...other not relevant columns...)
  • Attack 1
  • Attack 2
  • Attack 3

The last three columns should reference a row of the Attacks table. I want to be able to validate these cells so that only Attacks table's Attack name column values can be entered and, more important, if I change the value of an Attack name in the Attacks table, the corresponding value in the Characters table gets updated automatically with the new value. Also, should I sort the Attacks table differently, the references in the Characters table should keep pointing to the original Attack names.

I hope it is more clear what I'm trying to achieve. If something is not clear, just ask me and I'll try to provide additional details. Thank you in advance for your help.

My tables data

Attacks table

Characters table

In my case, for example, I would like that, if I change the Attack name in the Attacks table for the Water Attack and rename it to Rain Attack, the value in row Water Creature and column Attack 1 of the Characters table would automatically change, from Water Attack to Rain Attack.

user1945293

Posted 2018-07-21T13:32:03.257

Reputation: 21

it should be possible, but I'm not sure if I understand your goal correctly. Maybe you can make a specific example (e.g.. with a screen shot). – Albin – 2018-07-21T14:16:34.087

I have updated my question with additional details on my specific case. If something is not clear just ask me, and I'll provide additional details. Thank you in advance for your help. :) – user1945293 – 2018-07-21T17:51:05.440

Good job! The general description is much better now, thanks. But to make sure I understand what you mean I need at least one example that shows the actual table with the data (or both tables in your case). – Albin – 2018-07-21T18:02:10.193

PS. It would also make it easier to understand the general description – Albin – 2018-07-21T18:23:45.873

I have updated my question with the screenshots of actual tables' data. If you need additional details just let me know. Thank you very much for your attention. – user1945293 – 2018-07-21T19:30:53.930

Thanks, at the moment I have some work to do, but I'll answer you, please be patient. And yes, so far I think it can be done without VBA. – Albin – 2018-07-23T10:57:36.090

Answers

0

Here's a "quick" fix, check if this already works for you, if not let me know where the problems are:

  • Select an "attack"-cell in your character table, for example the the cell K2 (K: column "Attack1", 2: row "Water Creature").
  • Type "=" into the cell, this will "start" a formula (don't hint enter yet)
  • go to your attack table and select the appropriate attack, in this case it's cell A2 (A: column "Attack name, 2: row "Water Attack"): the formula will look similar like this: "=Tabelle1!A2"
  • hit enter

Now you "referenced" the "attack cell" in the character table with the "attack name cell" in the attack table. All changes in to the Attack name will be visible in the character sheet as well (try changing Water Attack to Rain Attack to see what I mean). You "move" the row in the attack table by using the sorting function, and use cut&paste the whole row some where else. The reference will still work. If you use copy the reference will "stay" with the original row.

Albin

Posted 2018-07-21T13:32:03.257

Reputation: 3 983

Thank you for your answer. Unluckily, if I change the rows sorting in the Attacks table, the respective Attack 1 in the Characters table changes as well: it keeps referencing the cell at the old coordinate (row, column). – user1945293 – 2018-07-23T12:26:42.010

@user1945293 damn, haven't thought about that... then we'll have to do it the "long" way... :S will it be a problem to add another column in your attack sheet that has a unique value for each row which won't ever get changed (for example the numbers 1,2,3,...) then I would use VLOOKUP to make the reference (by the way - the additional number is what's called a primary key, it's unique and once set unchangeable identifying a "dataset" (row), but it's only nice to know, if you are interested in using the right terminology). – Albin – 2018-07-23T16:49:37.263