Help

How may I count and sum up number of keywords?

Topic Labels: Formulas
1074 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Yu_Xun_Tee
4 - Data Explorer
4 - Data Explorer

Hi,

I am looking to write a formula that counts the total number of marks of a question and sum them up together as a value in a column.

marks of a question may be identified by square brackets in a field (e.g. [1] means 1 mark, [2] means 2 marks)

A sample of the field looks like this:

"Study the diagram below.

a) Circle what happened to the amount of food in the bowl after a few days. [1]

b) Based on the diagram above, name one substance this animal needs so that it
remains alive. [1]"

The total number of marks for this question would be 2 ( there are 2 [1]s which sums up to 2)

I was thinking that I may count the string “[1]” but the formula does not seem to have this function. I would need to find another way to work around it.

Any inputs/ ideas would be very much appreciated.

Thank you in advance!

1 Reply 1

Best approach is likely…

  • Create an automated action that fires whenever a record is added or changes.
  • The action should have a script step.
  • The script step would read the record and perform the metrics in javascript to find the occurrences you seek.
  • Lastly, the script would save the data to the desired field(s).

Javascript’s string and regex capabilities makes this especially easy to do.