Help

Re: Calculating the weighted average

Solved
Jump to Solution
1578 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Johannes_Strobe
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,

how can I calculate the weighted average? 

Example:
[-4, 0, 2, 0] -> I get this values via a roolup
I want the result to be -2 i.g.. Correct me please if I am wrong.

I'm open to use multiple formulas.

 

Best regards
Johannes

 

1 Solution

Accepted Solutions
stevendasilva
6 - Interface Innovator
6 - Interface Innovator

@Johannes_Strobe 

Just to confirm are you looking for the average but only if the result is not 0? 

If yes this has been solved over here:
https://community.airtable.com/t5/formulas/excluding-zero-values-from-an-average-rollup/td-p/26312

See Solution in Thread

3 Replies 3
stevendasilva
6 - Interface Innovator
6 - Interface Innovator

@Johannes_Strobe 

Just to confirm are you looking for the average but only if the result is not 0? 

If yes this has been solved over here:
https://community.airtable.com/t5/formulas/excluding-zero-values-from-an-average-rollup/td-p/26312

Johannes_Strobe
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi @stevendasilva ,

 

thanks. I already saw the post. While reading the message more closely, I found out that it actually is the solution for my problem. However, there is no example, so I didn't figure it out the first time.

My solution was to return BLANK() instead of a 0, when the Formula encountered a BLANK() at the first or second value. If this is done, the AVERAGE() function of the Rollup skips these values.

 

Example:
  • Values is the first table:
    • Data: The data are either blanks or numbers from 1 to infinite. They represent "bad" and "good" occurrences. 
    • Formula: IF(AND({👍}=BLANK(), {👎}=BLANK()), BLANK(), IF({👍}=BLANK(),-{👎},IF({👎}=BLANK(),{👍},{👍}/({👎}+{👍}))))
    •  
  • Rollup in the other table: IF(COUNTA(values)!=0, AVERAGE(values), BLANK())

 

Best regards
Johannes
stevendasilva
6 - Interface Innovator
6 - Interface Innovator

@Johannes_Strobe  Awesome, nice work.