How to create a conditional ranking system based on user level and a numeric range?

Hi! I’m trying to implement a dynamic classification system using if-then-else, but I’m stuck on how to check multiple conditions together.

Here’s what I need:

  • I have a user level field (Beginner, Intermediate, Advanced)
  • I also have a Rollup value that sums up the number of series for a training plan
  • Based on the user level, I want to classify that rollup into 3 categories (e.g., Low / Medium / High volume)

The ranges depend on the level, like this:

  • Beginner:
    • Low: 0–6
    • Medium: 7–12
    • High: 13+
  • Intermediate:
    • Low: 0–9
    • Medium: 10–15
    • High: 16+

So, if one user is a Beginner and has a rollup of 10, the result should be “Medium Volume” —
but if another user is Intermediate with the same rollup 10, the result should be “Low Volume”.

The problem: If-Then-Else only lets me evaluate one condition at a time, and doesn’t support AND or value ranges directly.

How could I structure this logic in Glide?

Thanks in advance!

Quick chatGPT ask. Try the following in a javascript column. I haven’t tested this.

// Inputs: userLevel (string), rollup (number)
function classifyVolume(userLevel, rollup) {
  if (userLevel === "Beginner") {
    if (rollup <= 6) return "Low Volume";
    else if (rollup <= 12) return "Medium Volume";
    else return "High Volume";
  } else if (userLevel === "Intermediate") {
    if (rollup <= 9) return "Low Volume";
    else if (rollup <= 15) return "Medium Volume";
    else return "High Volume";
  } else if (userLevel === "Advanced") {
    // You can define your own ranges for Advanced
    if (rollup <= 12) return "Low Volume";
    else if (rollup <= 18) return "Medium Volume";
    else return "High Volume";
  } else {
    return "Unknown Level";
  }
}

// Example usage
const userLevel = p1; // assuming Glide passes this in
const rollup = parseInt(p2); // make sure it's a number
return classifyVolume(userLevel, rollup);
2 Likes

Thank you. I’m not used to JS in glide, so haven’t tried asking GPT for one, just for other ways to do this logic, guess I’ll use more JS from now on hahaha. Thanks!!

1 Like

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