Calculation of Gain or Loss on Trade-In

Follow up to previous post 

If the vehicle that was traded in was used only 31.2% for business during the time the car was owned and in service, how do you calculate the gain or loss?

Old Vehicle Original purchase price in 2015:  $23,500

Traded towards new vehicle in 2023 - trade in value received:  $2,500

Old vehicle was used approximately 31% for business use each year from 2015 through 2023. 

Do I take the original price ($23,500) and multiply by average business percentage (31%) to determine gain or loss?  Or, since it was not used 100% for business, is this calculation ignored?

Note:  No depreciation was taken - standard mileage rate used each year until 2023 (year vehicle was traded in). 

Thx in advance -