# 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.

You can view my existing formatting here: https://docs.google.com/spreadsheets/d/1X3QhewPXvp0bhu7UTzd0s2qzYZtKTRm1YGM96OEk6Ng/edit?usp=sharing

• In the case of 8 entries in \$A, the result I'm looking for is _B="PB" true: 203.63855355 false: 150.843373 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 Mar 13 '19 at 0:55
• The following was a possible remedy to my inquiry. 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))) Mar 13 '19 at 3:00