Re: Struggling to create a Substitute formula

1672 0
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

I’m working on a character generator for Dungeons and Dragons and I’m having trouble building a formula to get all the information in one place.

This is the view on the form I created:
Screen Shot 2021-08-10 at 1.22.19 PM

My goal is to create a formula that get rid of the numbers and just displays what Race the player selected (elf, dragonborn, etc.) for easier readability in grid view.

When I write the formula to only refer to a single number it works fine.
Screen Shot 2021-08-10 at 1.26.39 PM

But when I try and have the formula substitute multiple numbers with a blank space it returns an error message.

Screen Shot 2021-08-10 at 1.25.31 PM

I was using the example formula on the side as a reference which uses => instead of a comma to separate the value being substituted with the new value but that didn’t make a difference. I’m pretty sure I copied the format of the example correctly otherwise so I’m not sure what I’m doing well.

I have no experience programming, I’m just teaching myself as I go along so any help/advice would be extremely appreciated. Thank you!

4 Replies 4
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi there! Try this:

REGEX_REPLACE({Race (d12)}, "\\d+\\.\\s", "")

This formula uses regular expressions to replace combination of number, period and empty space with a given string (in our case empty string “”).

10 - Mercury
10 - Mercury

Hi Tom. Just wondering why you numbered them in the first place? The numbers don’t signify anything do they?

Hey augumented, I numbered them because it’s basically a table for people to roll on during character creation. So they’d roll a 12 sided die for race.

Thanks Ela I tried it and it works!!!