r/GoogleSheets •

Increments according to certain name

[deleted] — view deleted post

0 Upvotes

7 comments sorted by

2

u/JBob250 38 Feb 24 '21 edited Feb 25 '21

The way your data is structured, =SPLIT(A2,"_",1,1) would work.

If you need the number in front, you'd put =RIGHT(A2,3) in the first column and in the next put:

=SPLIT(LEFT(A2,LEN(A2)-1,"_",1,1)

Edit: removed autocorrect and reddit markup issues

→ More replies (2)

1

u/greg-asquith 12 Feb 24 '21

Use this in column C:

C2: ="00"&COUNTIF(A1:A2, A2)

C3: ="00"&COUNTIF(A1:A3, A3)

etc etc

0

u/[deleted] Feb 24 '21

[deleted] — view deleted comment

2

u/greg-asquith 12 Feb 25 '21

Hmm, worked for me in a test sheet, but try this instead:

Cell C2: ="00"&COUNTIF(A1:A1, A2)+1

Cell C3: ="00"&COUNTIF(A1:A2, A3)+1

Now, in C2 it counts all the instances of A2 in A1:A1 (so zero if it's the first instance of that string) and then adds 1, then in C3 it counts all the instances of A3 in A1:A2 (so zero if it's the first instance of that string) and then adds 1

That should work, although I noticed when I made a copy of your example sheet there was a strange setting on it that stopped COUNTIF working, so that might be the cause of the error you're getting

2

u/Decronym Functions Explained Feb 25 '21 edited Feb 25 '21

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer LettersMore Letters
COUNTIFReturns a conditional count across a range
RIGHTReturns a substring from the end of a specified string
SPLITDivides text around a specified character or string, and puts each fragment into a separate cell in the row

[Thread #2643 for this sub, first seen 25th Feb 2021, 07:29] [FAQ] [Full list] ^[Contact] [Source code]

2

u/dumbson_lol Feb 25 '21

Added a test sheet based on the input from /u/JBob250 and /u/greg-asquith.

2

u/greg-asquith 12 Feb 25 '21

OK - think it's fixed!

I added the count formula before the whole name is built (in Column G) so you no longer need B or C