Use switch if to increase value of cell

Is there a way to increment the value of a cell by one using ‘switch if’? I’m trying to make a table that automatically assigns a score to each row depending on multiple factors across columns. Here are the specifics:

  • The purpose of the table is to track the value of SEO keywords based on multiple factors (inspired by Ubersuggest’s ranking system)
  • Each keyword gets its own row
  • The fields for each column are: keyword, search volume, cost per click, paid difficulty, SEO difficulty usage, notes, and score

Every time a value of ‘true’ is returned on one of the following conditions, I want to add 1 to the value of that row’s ‘score’:

  • thisRow.SEO Difficulty < 40
  • thisRow.Paid Difficulty < 40
  • thisRow.Cost per Click > 0
  • thisRow.Cost per Click > 5
  • thisRow.Search Volume > 10
  • thisRow.Search Volume > 50
  • thisRow.Search Volume > 100
  • thisRow.SEO Difficulty < 40 && Cost per Click > 5

Thank you in advance for your help!

Hi Shaina,

Switchif() is not going to work in this situation - it stops executing when it gets to the first expression that results in true.

I would suggest to use runActions() to evaluate each of those expression in series. If the If() expression is true, add one to a column that you use as a counter.

See the last example on the page below:

Regards
Piet

2 Likes

Thank you for your reply! That makes sense. Is there any way to accomplish this without requiring a button for each row?

Yes! I would recommend the non-button route

What you should likely do is create a list of true/false values, then filter that list to find values that are TRUE, then count your new list

So:

  • List(thisRow.status = Done, thisRow.amount>40, thisRow.date = today()).filter(currentValue=true).count()

That should essentially return a count of the true values within your list, aka assigning one point per true value

Simply input all your statements into the List() formula rather than my fake ones

3 Likes

Very clever idea!

I was stuck on getting it done using runaction(), which forces me into a button.

Brilliant! That worked perfectly. Thank you!

Hello @Shaina_Nacion ,

I don’t know how your information is collected and how it finds its way into your document (or table), but there is an alternative very easy solution:

The formula in “score” is very simple:
thisRow.[SEO Difficulty <40]+thisRow.[Paid Difficulty <40]+thisRow.[Cost per Click >0]+thisRow.[Cost per Click > 5]

This is probably not how I would organize my data, but with the limited knowledge of your project this might work for you.
Greetings, Joost

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.