Find last value in column greater than zero and copy row

swapnilk

Board Regular
Joined
Apr 25, 2016
Messages
75
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,

I need help with a formula.

I have a column A with numeric data in it. i want to check column A for last value greater then zero and then I want to copy the entire row.

ABCD
1100AppleAppleApple
252RedRedRed
346OrangeOrangeOrange
40YellowYellowYellow
50GreenGreenGreen

<tbody>
</tbody>


With the above sample data i want to check in column A the last non zero value which in this case will be cell A3 and then copy A3:D3 to some other sheet.

Thanks!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Excel 2010
ABCD
1100AppleAppleApple
252RedRedRed
346OrangeOrangeOrange
40YellowYellowYellow
50GreenGreenGreen
Sheet5



Excel 2010
ABCD
146OrangeOrangeOrange
Sheet6
Cell Formulas
RangeFormula
A1=LOOKUP(2,1/(Sheet5!$A$1:$A$5<>0),OFFSET(Sheet5!$A$1:$A$5,,COLUMN(A1)-1))
 
Upvote 0
Thank you very much sheetspread the formula worked.

I forgot to mention there are some rows hidden and i want the formula to apply only to visible cells. The formula should search for last non zero value in column A (with hidden rows) ignoring the rows which are hidden.

Is it possible to achieve ?
 
Upvote 0
If we hide row 4 of:


Excel 2010
ABCD
1100qwe
20zxc
332tggf
42jkv
50poi
Sheet5


to get:


Excel 2010
ABCD
1100qwe
20zxc
332tggf
50poi
Sheet5


then:


Excel 2010
ABCD
132tggf
Sheet6
Cell Formulas
RangeFormula
A1{=LOOKUP(2,1/(IF(Sheet5!$A$1:$A$5<>0,IF(SUBTOTAL(103,OFFSET(Sheet5!A1,ROW(Sheet5!$A$1:$A$5)-ROW(Sheet5!A1),0)),ROW(Sheet5!$A$1:$A$5)))),OFFSET(Sheet5!$A$1:$A$5,,COLUMN(Sheet5!A1)-1))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,106
Messages
6,123,124
Members
449,096
Latest member
provoking

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
Back
Top