Simple Row Count for Table

Vintage79

Board Regular
Joined
May 29, 2007
Messages
185
Office Version
  1. 2019
Platform
  1. Windows
Hello All,

I would like to create a simple row count that can return a 2 digit number. I have a table of data, and in the first column, I would like there to be a reference number:


Excel 2010
BCD
4Ref No.DayDate
5Ref893 01Saturday10-Mar-18
6Ref383 02Saturday10-Mar-18
7Ref109 03Saturday10-Mar-18
Sheet1
<p style="width:2.4em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Test</p><br /><br />The first part of the reference will be taken from elsewhere on the sheet, so I just need to add in the 01, 02, 03 etc. The simple part is that the numbers will be sequential, so I just need a way of counting how many rows down the row is from B4. So, what's the best way to do this, and return a numerical count?

Thanks in advance for any assistance!
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Something like this, copied down?

Excel Workbook
BCDE
4Ref No.DayDate
5Ref893 01Saturday10-Mar-18893
6Ref383 02Saturday10-Mar-18383
7Ref109 03Saturday10-Mar-18109
Ref No
 
Last edited:
Upvote 0
Thank you Peter! The formula =TEXT(ROWS(B$5:B5),"00")) works perfectly for me.

I've noticed that there seems to be an issue with adjusting formulas once they are in place on the table. For example when I enter a new date in D8, a new row is entered into the table, and then formulas self-complete, which is fine. But then the font in B7 gets returned to the default setting (Calibri 11pt in my case).

The only solution I have found, is to start a fresh table each time, on a fresh worksheet, and enter everything from scratch. Is this common with tables?

Thanks again for the help!
 
Upvote 0
Ok, I think I have found the issue!

Let's go with this example:


Excel 2010
BCD
4Ref No.DayDate
5W2 / 01Sunday11/03/2018
Sheet1
<p style="width:3em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Test2</p><br /><br /> Formulas:
B5: =IF($C$2="","",("W"&$C$2&" / "&(TEXT(ROWS(B$5:B5),"00"))))
C5: =IF(D5="","",TEXT(D5,"dddd"))


So, when I enter a new date in D6, the new row is created, but the formula in B5 gets changed to =IF($C$2="","",("W"&$C$2&" / "&(TEXT(ROWS(B$5:B6),"00")))) and the formula in B6 becomes =IF($C$2="","",("W"&$C$2&" / "&(TEXT(ROWS(B$5:B7),"00"))))
It worked fine when I tested it before, but this seems to be the reason why cells are returning to default fonts. How can formulas change? I haven't seen this problem before!
 
Last edited:
Upvote 0
Sorry, I didn't realise that you had a formal table. Try this in B5, adjusting 'Table1' to your table name if required.

=IF($C$2="","",("W"&$C$2&" / "&(TEXT(ROWS(Table1[#Headers]:[@[Ref No.]])-1,"00"))))
 
Upvote 0
That works perfectly. Thanks again for the help Peter, it's deeply appreciated! :)
 
Upvote 0
As I am new to tables, I have a small query that is slightly related, and didn't think it warranted a new thread:

Is it possible to refer to the column of a table by it's number or position, rather than by name? This would be useful in a case where the header of a column might change.

=TableName[2nd Column] something like this is what I mean. Or maybe even using the cell letter: =TableName[D:D]. The idea is to refer to the data below the header of a certain column.
 
Upvote 0
If you wanted to refer to, say, the third column then INDEX(Table1,0,3)
For example, to return the maximum value from the third column =MAX(INDEX(Table1,0,3))
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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