Best way to count instances of a linked value in a table

I have a service where users can give their friends a referral code and if a new user signs up using a code, both referrer and referee get a bonus.

I have a Users table that includes a field for a unique referral code generated for each user. This is the code they can share with their friends.

If someone signs up using one of these codes, it gets writtten to a referer code field for the new users record - this value will always correspond with a referral code from a pre-existing user record in the same table.

For each referal code I want to calculate the number of times its been used by a referree - whch mean counting the number of times that same code appears in the referrer code field in my Users table.

What’s the best way to calculate this value?

Here’s a previous thread where a similar scenario was discussed:

Will that solution work in your case?

Thank you - this is pretty much my scenario. I’m trying to use the G Apps script solution but i’m new to all that and not entirely sure how to trigger it.

I think the Airtable-only solution also mentioned is manual right? I need my solution to auto-increment the referrals count with each new record written to my Users table. I’m using Zapier to write these records.

Cheers

Correct. Manual creation of links between records.

I saw your question to Bill in the thread I linked, so I’ll await his reply there re: tying things in to Zapier using his script-based solution.

1 Like