# If, Then formula

Solved/Closed
eaglewings1983 Posts 2 Registration date Friday January 11, 2013 Status Member Last seen January 14, 2013 - Jan 14, 2013 at 08:40 AM
eaglewings1983 Posts 2 Registration date Friday January 11, 2013 Status Member Last seen January 14, 2013 - Jan 14, 2013 at 10:25 AM
Hello,

I am creating a spreadsheet for the company airplane. Part of it is to calculate how many of the miles flown were "occupied" (had passengers). I need to do this for each leg of the flight.

so leg 1 had 300 miles and 2 passengers. Occupied miles would be 300*2=600.
However, if there were no passengers, than the occupied miles is equal to the miles in the leg, or 300.

I need says if passengers is 0 than occupied miles = leg miles but if passengers is greater than 0 than multiply the leg miles by the passengers.

If anyone knows of a way to do this I would be so grateful.
Thank you!

## 1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Jan 14, 2013 at 10:18 AM
Hi Eaglewings,

Passengers are in A1.
Miles flown are in A2.

Formula:
=IF(A1=0,A2,A1*A2)

Best regards,
Trowa
eaglewings1983 Posts 2 Registration date Friday January 11, 2013 Status Member Last seen January 14, 2013
Jan 14, 2013 at 10:25 AM
Thank you!!! That worked beautifully. You just saved me hours!