Results 1 to 3 of 3

Thread: adding values from different named ranges based on yes/no selected

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,290
    Location
    If you are using Excel 365 then you can try something like the below, clear the results that are in range C7:C18 and place the below into cell C7. It is a spill formula so it will populate cells C7:C18 by spilling into them, this is why C7:C18 must be empty before you place the formula into cell C7.

    =LET(
      n,FILTER($X$3:$X$32,$W$3:$W$32="Yes"),
      s,DROP(REDUCE("",n,LAMBDA(a,x,HSTACK(a,INDIRECT(x)))),,1),
      d,TAKE(DROP('Enrollment Input'!$A:$A,2),ROWS(s)),
      t,HSTACK(d,s),
      f,HSTACK(d,FILTER(t,TAKE(t,1)=C$6)),
      BYROW($B$7:$B$18,LAMBDA(x,SUM(DROP(FILTER(f,TAKE(f,,1)=x),,1))))
    )
    Your claims info formula in cell H7 would be similar:
    =LET(
      n,FILTER($Y$3:$Y$32,$W$3:$W$32="Yes"),
      s,DROP(REDUCE("",n,LAMBDA(a,x,HSTACK(a,INDIRECT(x)))),,1),
      d,TAKE(DROP('Claims Input'!$A:$A,2),ROWS(s)),
      t,HSTACK(d,s),
      f,HSTACK(d,FILTER(t,TAKE(t,1)=H$6)),
      BYROW($B$7:$B$18,LAMBDA(x,SUM(DROP(FILTER(f,TAKE(f,,1)=x),,1))))
    )
    Attached Files Attached Files
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2408, Build 17928.20080

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •