Formula to find last row in a range

Shadkng

Active Member
Joined
Oct 11, 2018
Messages
365
Hi, I am using the formula below to determine if all entries in a column range are the same (if they are than it inserts that item). The range starts at G41 and the indirect is picking up the last row number based on a value in A1. I use this type of formula many times in my workbook and rather than have all of those indirects I am looking for an alternative - maybe using a method to find the last row with data. I researched online but not sure which is the best method. Any help is appreciated.

Code:
=IF(COUNTA($F$41:INDIRECT("$F"&$A$1))=COUNTBLANK($F$41:INDIRECT("$F"&$A$1))," ",IF(COUNTIF($F$41:INDIRECT("$F"&$A$1),$F$41)=(COUNTA($F$41:INDIRECT("$F"&$A$1))-COUNTBLANK($F$41:INDIRECT("$F"&$A$1))),$F$41,""))
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
33111
444
55this is row 1111G is a helper column
you want to find thisthat provides the row number
last row and put 11 in B1of all non blank cells in column A
B1 finds the largest number
in the helper column
it looks at 100 rows at present

<colgroup><col width="64" span="14" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Hi manually you can just click at the same time on Ctrl and down arrow. It will lead you to the last row with data and if you click twice, you will go at the last roww of the excel sheet, which is 1048576.

Regards
 
Upvote 0
shadkng the helper column looks at column A and if the cell is not blank returns the row number, so the biggest number in the helper column is the row containing the last non blank cell in column A.
 
Upvote 0

Forum statistics

Threads
1,215,233
Messages
6,123,772
Members
449,123
Latest member
StorageQueen24

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