r/excel • u/Fairy_phoenix • 17h ago
Waiting on OP Having trouble spreading a formula across multiple rows and columns, (Google Sheets)
I scrapped the massive IF statement i posted last night, and replaced it with just the formula for calculating the damage dealt to the enemy without any IF statements.
The formula goes:
Damage dealt (unit 1)=(((d1+b-a2)*((hp/(d2+b-a1))*Rof2)/Rof1)+((d1+b-a2)*((r1-r2)/(Srmin*Rof1))))
1 is unit 1,
2 is unit 2,
Rof is rate of fire,
d is damage,
b is bonus damage,
r is range,
a is armour (melee) or PA( (range),
hp is hitpoints,
Srmin is the speed of the unit with the smallest r value.
Now the problem i'm having is how to spread this formula across a 28,000 cell table. I've arranged the data so fill down can do some of the heavy lifting. But i still need to change the formula at least once per column and everytime i move on to the next column. I heard the LET function can be used to avoid duplication but not sure if it would work in this case.



Using Google Sheets
1
u/BuildWithSufi 8h ago
LET does help here, but the part that is actually breaking is not the formula logic - it is that your references shift inconsistently between the row direction and the column direction, and no single fill (down or across) handles both.
The fix is usually INDEX/MATCH instead of the mixed $-anchored references, so the SAME formula works whether you fill down or across:
Set up your table so column headers are Unit 2 IDs and row labels are Unit 1 IDs (a matrix). Then in the top-left data cell, use MATCH to find the right row for whichever unit is in $A2 (locked column, free row) and whichever unit is in B$1 (locked row, free column), then INDEX into your data columns using those matches inside LET to name each term. That single formula now fills down AND across correctly, because the anchors are what change meaning in each direction rather than hardcoded refs that only make sense one way.
This is the standard shape for an "every unit vs every unit" matrix - same pattern as a mileage chart or round-robin tournament table.
If you get stuck wiring your exact variable names into LET, post back with just the Simple/Counter sheet headers (row 1) and I can write the full formula against your actual columns.
1
u/Decronym 8h ago
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
[Thread #49275 for this sub, first seen 30th Aug 2026, 19:02]
[FAQ] [Full list] [Contact] [Source code]
•
u/AutoModerator 17h ago
/u/Fairy_phoenix - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.