# How do you sum the single max values of multiple ROWs?



## thp510 (Thursday at 4:55 PM)

You folks are amazing. I have another problem hoping for your help! 

I have several rows of dollar data and I'm trying to find the maximum dollar number on that row, _if the row is selected (see column B). _Then I want to sum it all together. What function should I use in cell K12? 






Here's the data again.

SelectionItem ZItems BItem DDDItem 433Item A23Max ValueMax Value of Selected$ 150,000$ -$ -$ 45,000$ -$ 150,000X$ -$ 456$ 46,666$ -$ -$ 46,666$ 46,666$ -$ 545$ -$ -$ 7,879$ 7,879$ 4,566$ -$ 3,354$ 4,454$ -$ 4,566X$ -$ -$ 474,444$ 45,678$ -$ 474,444$ 474,444X$ 260,000$ -$ 200$ 4,457$ -$ 260,000$ 260,000$ 3,456$ -$ 2,131$ 2,134$ -$ 3,456$ -$ 475,000$ 600,000$ 1,114$ -$ 600,000SUM:$ 1,547,011$ 781,110


----------



## tezza (Thursday at 5:06 PM)

If I understand right I would use the following in K3 and drag it down


```
=IF(B2="","",MAX(C2:G2))
```

if B is empty then show nothing otherwise show the max value between C & G

K12 would just be


```
=sum(K3_K10)
```


----------



## thp510 (Thursday at 5:08 PM)

tezza said:


> If I understand right I would use the following in K3 and drag it down
> 
> 
> ```
> ...


Yes, but I'd rather not add a helper table and just find one single function that can sum things up based on my X selection criteria in column B.


----------



## shift-del (Thursday at 5:36 PM)

Hi

Maybe this:

```
=SUMMIFS(I2:I9,B2:B9,"X")
```


----------



## tezza (Thursday at 6:21 PM)

thp510 said:


> Yes, but I'd rather not add a helper table and just find one single function that can sum things up based on my X selection criteria in column B.


Are you looking to remove certain Columns from your OP or do you simply want the following in K12?


```
=sum(K3_K10)
```

If you want something else then may show an example of what you see as the finished product.


----------



## thp510 (Thursday at 11:03 PM)

tezza said:


> Are you looking to remove certain Columns from your OP or do you simply want the following in K12?
> 
> 
> ```
> ...


I'd like to know what would be the function in cell K12 just by marking "X" on the various rows in column B. The Cells I3:K10 were just showing as an example what the max value was on that row ("helper columns"). Hope that makes sense. Otherwise, I guess I can just put in the helper columns on columns I and K and just sum it up.


----------



## Fluff (Yesterday at 8:35 AM)

How about

```
=SUM(BYROW(FILTER(B2:F10,A2:A10="X"),LAMBDA(br,MAX(br))))
```


----------



## tezza (Yesterday at 9:16 AM)

Fluff said:


> How about
> 
> ```
> =SUM(BYROW(FILTER(B2:F10,A2:A10="X"),LAMBDA(br,MAX(br))))
> ```


I've been trying to solve this but failed so far.

Could you break this down as to how it works by any chance?


----------



## Fluff (Yesterday at 9:22 AM)

The filter function returns the rows that have an X in col A.
The byrow function then "loops" through those rows & returns the max value for each row.
Finally the sum function adds them all up.

HTH


----------



## tezza (Yesterday at 9:32 AM)

Fluff said:


> The filter function returns the rows that have an X in col A.
> The byrow function then "loops" through those rows & returns the max value for each row.
> Finally the sum function adds them all up.
> 
> HTH


Cheers  .  What about the Lamda part?


----------



## thp510 (Thursday at 4:55 PM)

You folks are amazing. I have another problem hoping for your help! 

I have several rows of dollar data and I'm trying to find the maximum dollar number on that row, _if the row is selected (see column B). _Then I want to sum it all together. What function should I use in cell K12? 






Here's the data again.

SelectionItem ZItems BItem DDDItem 433Item A23Max ValueMax Value of Selected$ 150,000$ -$ -$ 45,000$ -$ 150,000X$ -$ 456$ 46,666$ -$ -$ 46,666$ 46,666$ -$ 545$ -$ -$ 7,879$ 7,879$ 4,566$ -$ 3,354$ 4,454$ -$ 4,566X$ -$ -$ 474,444$ 45,678$ -$ 474,444$ 474,444X$ 260,000$ -$ 200$ 4,457$ -$ 260,000$ 260,000$ 3,456$ -$ 2,131$ 2,134$ -$ 3,456$ -$ 475,000$ 600,000$ 1,114$ -$ 600,000SUM:$ 1,547,011$ 781,110


----------



## Fluff (Yesterday at 9:37 AM)

That's just part of the byrow function.


----------

