Maximum of Column A until 0

csvirtual

New Member
Joined
Oct 15, 2005
Messages
25
Hi!

In column B I need to have the maximum of all Rows in column A until a cell has the value 0.

Example:
..A B
1 2 3
2 3 3
3 1 1
4 0
5 1 5
6 3 5
7 5 5
8 1 1
9 0

Any help appreciated

thx
Christian
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

RAM

Well-known Member
Joined
Oct 4, 2004
Messages
1,862
Hi,

This is not really as you presented it, but is this something like what is expected?
Book7
ABCD
1111
2233
3313
4414
550 
6636
7757
8818
990 
10
11
Sheet1


Copy down the formula in C1.

Hope this helps

RAM
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,327
Office Version
  1. 365
Platform
  1. Windows
csvirtual

Try this. Formula in B1 (copied down):
=IF(A1=0,"",MAX(OFFSET(A1,0,0,MATCH(0,A1:A$9,0))))
Mr Excel.xls
ABCD
123
233
311
40 
515
635
755
811
90 
10
Max Till 0
 

csvirtual

New Member
Joined
Oct 15, 2005
Messages
25
@Ram: Thank You but the first Column was just the Row.

@Peter_SSs

Thank You. It's the right formula.
I have one Problem: I would like to have it this way and i just changed the Cells but it doesnt work (#NV):

=IF(W8=0,0,MAX(OFFSET(E8,0,0,MATCH(0,E8:e$65536,0))))

What's wrong with it?
If in Cell W... is a 0 than take the maximum of E65536 to E8 (as it should start from bottom) until W..=0

Hope You can help me again.

thanks
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,327
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

csvirtual said:
...
I have one Problem: I would like to have it this way and i just changed the Cells but it doesnt work (#NV):

=IF(W8=0,0,MAX(OFFSET(E8,0,0,MATCH(0,E8:e$65536,0))))

What's wrong with it?
If in Cell W... is a 0 than take the maximum of E65536 to E8 (as it should start from bottom) until W..=0

Hope You can help me again.

thanks
Please try to expalin again more clearly. Your formula starts off IF(W8=0,0,... but your explanation says 'If in Cell W... is a 0 than take the maximum of E65536 to E8'. These seem to contradict.

Perhaps you could give another small sample of data (columns E and W at least) and the expected results?
 

csvirtual

New Member
Joined
Oct 15, 2005
Messages
25
excel.jpg


I hope you understand. I find it difficult to say it in words, as my english is not that good.

Thank you
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,327
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

OK

You were not far off. In AJ2 try this and copy down:
=IF(W2=0,0,MAX(OFFSET(E2,0,0,MATCH(0,W:W,0))))

Edit: Sorry this does not do it, I will need to re-think this.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,327
Office Version
  1. 365
Platform
  1. Windows
Trying again, AJ2:
=IF(W2=0,0,MAX(OFFSET(E2,0,0,MATCH(0,W2:W$65536,0))))

This is close to what you had but the MATCH for zero needs to be on column W, not E. With this formula, the last value in column W will need to be 0 or there will be some #N/A errors at the bottom of column AJ.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,002
Messages
5,834,821
Members
430,324
Latest member
bosphoruskid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top