Replace Numbers with Asterisks

Learn how to replace numbers with asterisks in Google Sheets using regular expressions. This tutorial covers the REPLACE function and how to apply it across an entire column effortlessly.

So, you want to hide some digits, some numbers, some numbers between 0 and 9. You want to hide them and replace them with asterisks. You might want to do this because you're hiding credit card information, access codes, you're masking order IDs, you're creating top secret classified information, or you're just creating sales training, price templates, that kind of thing. I'm going to show you how to do that in a simple formula . Equals rejects. So, reax or regular expressions have three interesting formulas. one we can say hey does it match one we can say hey just take out this matching thing or third which is what we're using today reax replace which is saying if you find this thing replace it with this other thing okay so we're going to use reax replace now we need three things we need the

text that we're going to replace we need the code or the piece of information that we're like hey what are we looking for we're going to have that in quotes and then we're going to have the third thing which is we're going to say what are we going to to replace it with. And in quotes, we're going to have an asterisk or a star or anything you want. Right now, you see this crazy thing because we don't have a code. We're not saying, "Hey, look at this specific thing." So, let's do that. In quotes, inside square brackets, we're going to put 0- 9. And what that means is we're looking for the numbers 0 through 9. We don't have to put in 0 1 2 3 4 5 6 7 8 9. We just put zero hyphen 9 in square brackets inside of our quotes. And you

can see when we get to the end, it shows us an example of what this text in B3 will look like. And that is exactly what we want. If you haven't put the asterisk in, it'll just look like this. But we want to replace each number with an asterisk. If you want two asterisks, put two asterisks there. But end parenthesis and hit enter. and then copy and paste down. But what if you don't want to copy and paste down? Look at that agent dot dot dot uh very classified super top secret secrets. What if you want don't want to actually copy paste all the way down? We can wrap this with array formula . Wrapping it with array formula means we can change this B3 to colon B. B3 colon B and that will be the entire

what we need array formula not a formula array formula will do it. Hit enter. And now the entire column is hidden . Information is done for us with just this one formula . So that's pretty cool. I like reax. I like all the reax here. They're really fun. They're really cool to figure out this little code. It's sort of learning a new language of saying, "Hey, look at this information in this particular way and then do this asterisk on top of it." You're watching Better Sheets here on YouTube. Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how-tos, get more out of your Google Sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos. But for right now,

right here, one of these videos is going to be your next Google Sheet.