Results 1 to 5 of 5

Thread: FORMULA EXPLAIN

  1. #1
    Junior Member
    Join Date
    Oct 2024
    Posts
    2
    Rep Power
    0

    FORMULA EXPLAIN

    Can anybody explain this fomrula

    REDUCE(0,H7:H10,LAMBDA(a,b,VSTACK(TAKE(a,1),a+b)))

    h7 1
    h8 2
    h9 3
    h10 4

    result
    0
    4
    7
    9
    10

    thanks

  2. #2
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    maybe it will help:

    The expression you provided is a formula in Excel or Google Sheets that uses the `REDUCE` function along with `LAMBDA`, `VSTACK`, and `TAKE`. Let's break it down:

    1. **REDUCE**: This function takes an initial value (in this case, `0`) and a range of values (from `H7:H10`). It applies a function to combine them iteratively.

    2. **Initial Value (0)**: The calculation starts with `0`.

    3. **Range (H7:H10)**: This is the range of cells that will be processed.

    4. **LAMBDA(a, b, ...)**: This defines an anonymous function that takes two parameters:
    - `a`: The accumulated value from the previous iteration.
    - `b`: The current value from the range being processed.

    5. **VSTACK(TAKE(a, 1), a + b)**: This part combines the results:
    - `TAKE(a, 1)`: This takes the first item from the accumulated value `a`.
    - `a + b`: This adds the current value `b` to the accumulated total `a`.
    - `VSTACK(...)`: This stacks the first item of `a` and the sum `a + b` vertically.

    ### What It Does
    Essentially, this formula iterates through the values in the range `H7:H10`, maintaining a running total while also storing the first accumulated value. The result is a vertical array where the first entry is the initial value (from `a`), and the subsequent entries are the cumulative sums of the values in `H7:H10`.

    ### Example
    If `H7:H10` contains values like `1`, `2`, `3`, and `4`, the output would be a vertical array:
    - The first value would be `0`.
    - The second would be `1` (0 + 1).
    - The third would be `3` (1 + 2).
    - The fourth would be `6` (3 + 3).
    - The fifth would be `10` (6 + 4).

    In summary, this formula creates a cumulative sum from the specified range, while also capturing the initial state.

    that's all what I can do 4 u
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  3. #3
    Junior Member
    Join Date
    Oct 2024
    Posts
    2
    Rep Power
    0
    Thanks for your explanation but final result is
    0
    4
    7
    9
    10
    i can't understand

  4. #4
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    you wanted an explanation of the formula (how it works), not a check of the result
    check step by steep:
    reduce
    lambda
    vstack
    take
    Last edited by sandy666; Today at 03:10 AM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  5. #5
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    later
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

Similar Threads

  1. Replies: 3
    Last Post: 03-07-2022, 05:12 AM

Posting Permissions

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