Skip to content

Instantly share code, notes, and snippets.

@monotykamary
Created December 18, 2024 11:26
Show Gist options
  • Select an option

  • Save monotykamary/d52eff16e7fd079c8ea1ce7befdfb3bd to your computer and use it in GitHub Desktop.

Select an option

Save monotykamary/d52eff16e7fd079c8ea1ce7befdfb3bd to your computer and use it in GitHub Desktop.
Excel/Sheets distribute value through Indirect count and substitution
=ARRAYFORMULA(
SUM(
IF(
INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(),4), "1", "") & "2:" & SUBSTITUTE(ADDRESS(1,COLUMN(),4), "1", "") & COUNTA($A:$A)) = "x",
INDIRECT("$R2:$R" & COUNTA($A:$A)) /
INDIRECT("$Q2:$Q" & COUNTA($A:$A)),
0
)
)
)
=ARRAYFORMULA(
SUM(
IF(
INDIRECT("B2:B" & COUNTA(A:A)),
INDEX(
INDIRECT("O2:O" & COUNTA(A:A)) /
COUNTIF(
INDIRECT("B2:K" & COUNTA(A:A)),
"x"
),
),
0
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment