Using equation and logging in csv. file

I am trying to log multiple variables in a csv. file using an sd card. I have the code to write the 2 different variables (plantCounter and wheelCounter) and they onto the sd card and show in excel just like I want them, but I am trying to make the arduino solve an equation such as (plantSensor/wheelSensor) so I do not have to do it in the csv. file after the fact. When I try to add this it jumbles up all my numbers in excel. So I want 3 variables in my csv. file; plantCounter, wheelCounter, and (plantCounter/wheelCounter). Is there a way to fix this? Sorry my code is sloppy, I am really new to coding.

#include <SD.h>

int plantSensor = 2; //Plant Sensor
int wheelSensor = 3; //Wheel Sensor
int plantCounter = 0; //Plant Sensor Counter
int wheelCounter = 1;  //Wheel Sensor Counter
int statePlant;
int laststatePlant = HIGH;
int stateWheel;
int laststateWheel = HIGH;
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers
int refreshrate = 10;
const int CS_PIN = 10;
const int POW_PIN = 8;

void setup() {
  Serial.begin(9600);
  Serial.println("Initializing Card");
  pinMode(CS_PIN, OUTPUT);
  pinMode(POW_PIN, OUTPUT);
  digitalWrite(POW_PIN, HIGH);
  if (!SD.begin(CS_PIN)) {
    Serial.println("Card Failure");
    return;
  }
  Serial.println("Card Ready");
  
  File commandFile = SD.open("speed.txt");
  if (commandFile) {
    Serial.println("Reading Command File");
    while(commandFile.available()) {
      refreshrate = commandFile.parseInt();
    }
    Serial.print("Refresh Rate = ");
    Serial.print(refreshrate);
    Serial.println("ms");
    commandFile.close();
  }
  else {
    Serial.println("Could not read command file.");
    return;
  }
}


void loop()
{
  //Plant counting loop
 int statePlant = digitalRead(plantSensor);
    if ( statePlant != laststatePlant) 
  {
     lastDebounceTime = millis();
     laststatePlant = statePlant;
     plantCounter=plantCounter+1;
        File dataFile =SD.open("log.csv",FILE_WRITE);
       if(dataFile)
        dataFile.print(plantCounter);  //Logging plants to SD card
        dataFile.print(",");
        dataFile.print((wheelCounter-1)/2); //Logging wheel slots to SD card
        dataFile.println(".0");
        dataFile.close();
        
        Serial.print(plantCounter); //Serial Print plants
        Serial.print(",");
        Serial.println((wheelCounter-1)/2); //Serial print wheel slots
  }
  //Wheel hole counting loop
 int stateWheel = digitalRead(wheelSensor);
    if ( stateWheel !=laststateWheel)
      {
        laststateWheel = stateWheel;
        wheelCounter = wheelCounter+1;
      }
     
  }

The below does not do what you think it does.

    File dataFile = SD.open("log.csv", FILE_WRITE);
    if (dataFile)
      dataFile.print(plantCounter);  //Logging plants to SD card
    dataFile.print(",");
    dataFile.print((wheelCounter - 1) / 2); //Logging wheel slots to SD card
    dataFile.println(".0");
    dataFile.close();

It will always write (or attempt to write) the comma, wheelCounter and ".0" and it will always (attempt to) close the file, even if it did not succeed in opening the file. Your are missing curly braces. You probably missed that because your code is not properly indented (the above snippet is). You can use T in the IDE to format the code.

You don't show how you add the third value to record in the file so it's difficult to say where you go wrong. Please post the code that fails.

This is the code where I am having problems with it logging in the correct format.

 int statePlant = digitalRead(plantSensor);
    if ( statePlant != laststatePlant) 
  {
     laststatePlant = statePlant;
     plantCounter=plantCounter+1;
        File dataFile =SD.open("log.csv",FILE_WRITE);
       if(dataFile)
        dataFile.print(plantCounter);  //Logging plants to SD card
        dataFile.print(",");
        dataFile.print((wheelCounter-1)/2); //Logging wheel slots to SD card
        dataFile.println(".0");
        dataFile.print(",");
        dataFile.print((plantCounter)/(wheelCounter));
        dataFile.close();
        
        Serial.print(plantCounter); //Serial Print plants
        Serial.print(",");
        Serial.println((wheelCounter-1)/2); //Serial print wheel slots
  }

Try formatting the code properly

int statePlant = digitalRead(plantSensor);
if ( statePlant != laststatePlant)
{
  laststatePlant = statePlant;
  plantCounter = plantCounter + 1;
  File dataFile = SD.open("log.csv", FILE_WRITE);
  if (dataFile)
    dataFile.print(plantCounter);  //Logging plants to SD card
  dataFile.print(",");
  dataFile.print((wheelCounter - 1) / 2); //Logging wheel slots to SD card
  dataFile.println(".0");
  dataFile.print(",");
  dataFile.print((plantCounter) / (wheelCounter));
  dataFile.close();

  Serial.print(plantCounter); //Serial Print plants
  Serial.print(",");
  Serial.println((wheelCounter - 1) / 2); //Serial print wheel slots
}

Now you can clearly see which program statements will be executed if the datafile is open.

Without knowing what the variable types are, what the code actually does, and what you expect, it is impossible to help you.

Post ALL of your code, and the actual data stored in the file, along with an explanation of what you expect.