Excel ROW() Reset

MrOaks

New Member
Joined
Apr 25, 2018
Messages
9
Morning all,

So I have a question about the ROW() function.

I'm using it with a combination of LEFT to create a unique REF in column A; for example, ABCD01.

It's made up of the first 4 characters of a document name and the ROW.

My question is: when the document changes down the list how can I get the ROW to reset to 1, so rather than being CDEF12 it would be CDEF01.

Current Code:
Code:
=IF(ROW()-3<10,CONCATENATE(UPPER(LEFT([@[Functional Area 
(BRE-130 Link)]],4)),"0",ROW()-3),CONCATENATE(UPPER(LEFT([@[Functional Area 
(BRE-130 Link)]],4)),ROW()-3))

It works great but I've never managed to figure out a way to restart at 1 in the same formula.

Hopefully, this makes sense.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Doesnt solve your problem but you can change that existing formula and shorten it to simply

=CONCATENATE(UPPER(LEFT([@[Functional Area(BRE-130 Link)]],4)),IF(ROW()-3<10,"0",""),ROW()-3)


Regarding your problem you need to clearly explain what you mean by "when the document changes"
 
Last edited:
Upvote 0
I think he means something like this:

=IF(A2<>"",UPPER(LEFT(A2,4)&TEXT(SUMPRODUCT(--(LEFT(A2,4)=LEFT($A$2:A2,4))),"00")),"")

where A2 is the first cell with data in the table's column of interest.
 
Upvote 0
Regarding your problem you need to clearly explain what you mean by "when the document changes"

Apologies. The spreadsheet has a column with a document name, so:
DOCUMENT1
DOCUMENT1
DOCUMENT1
DOCUMENT2
DOCUMENT2
DOCUMENT3
DOCUMENT3
DOCUMENT3

Column A is my REF that I want to reset ROW() to 1 when there's a new document on that row.
 
Upvote 0
I think he means something like this:

=IF(A2<>"",UPPER(LEFT(A2,4)&TEXT(SUMPRODUCT(--(LEFT(A2,4)=LEFT($A$2:A2,4))),"00")),"")

where A2 is the first cell with data in the table's column of interest.

I just wanted to say this is awesome, and works really well.

Would it be possible to get some help in replacing spaces with "" as LEFT(XX,4) is giving spaces on Documents when their name is XXX XXXXXXX XXXXXXXX etc.

Thanks.
 
Upvote 0
I just wanted to say this is awesome, and works really well.

Would it be possible to get some help in replacing spaces with "" as LEFT(XX,4) is giving spaces on Documents when their name is XXX XXXXXXX XXXXXXXX etc.

Thanks.

Never mind :) I figured it out...

Code:
=IF(L66<>"",UPPER(SUBSTITUTE(LEFT(L66,4)," ", "")&TEXT(SUMPRODUCT(--(LEFT(L66,4)=LEFT($L$4:L66,4))),"00")),"")
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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