# How do I calculate weighted rates in Google Sheets?

I would like to calculate the cost on \$D "Rent" with a weighted cost when the respective cell in \$B="PB". The calculation would be based on the formula 7x+1.3x=1252 where 7 is dependent on `COUNTIF(A2:A19,"<>")` and `x` is the calculated base rate per person, dependent also on that `COUNTIF` function. • In the case of 8 entries in \$A, the result I'm looking for is _B="PB" true: 203.63855355 false: 150.843373 – Jager Mitchell Mar 13 '19 at 0:41
• pls, add some more explanations... where you want what to calculate and what should be expected result. from which cells should be calculated the result. more info you provide, faster you will get your answer – user0 Mar 13 '19 at 0:55
• The following was a possible remedy to my inquiry. – Jager Mitchell Mar 13 '19 at 3:00
• =IF(A2=ʺʺ,ʺʺ,(IF(B2=ʺFFAʺ,D21/(COUNTIF(B2:B19,ʺFFAʺ)+1.3*COUNTIF(B2:B19,ʺPBʺ)),(D21/(COUNTIF(B2:B19,ʺFFAʺ)+1.3*COUNTIF(B2:B19,ʺPBʺ)))*1.3))) – Jager Mitchell Mar 13 '19 at 3:00

``````=ARRAYFORMULA(IF(A2:A19="",,IF(B2:B19="FFA", 