Forum Discussion

BarbCP's avatar
BarbCP
Copper Contributor
Mar 19, 2021

Adding a prefix if criteria are met

I need to add a prefix to any 7 digit number in a column containing numeric and alpha-numeric data. 

2 Replies

  • mtarler's avatar
    mtarler
    Silver Contributor
    more details or sample might be needed. Is it ONLY cells with exactly 7 characters or all cells? If not 7 characters then leave the value as is? Is it purely visual or must the value of the cell change. Is it ok to use a helper column?
    These questions will help determine what solution will work for you. i.e.:
    a) you could use custom formatting to display a prefix (that would be display only)
    b) using a helper column you can use a formula like =IF(LEN(A:A)=7,"prefix"&A:A,A:A)
    c) if this is an 'ongoing thing' that you will need to keep doing and not use a helper column then you might need/want a macro
    • SergeiBaklan's avatar
      SergeiBaklan
      Diamond Contributor

      mtarler Yes, we may only make different guesses what the question actually means. My understanding you shall first check if that's the number or text since column contains both and texts also could be 7 characters length.

Resources