How to connect TDS-gravity sensor and PH-4502C sensor to NodeMCU using CD74HC4067 16-Ch Multiplexer

Hi arduino community members, so i have a project where im controlling PH level and how many minerals contained in water. And im using NodeMCU which only have one analog input, so because of that im using the DC74HC4067 multiplexer.

Since im new to arduino im a little bit confused about how to run it, i've try the multiplexer and it works, but new problem comes where the sensors code are using formula to calculate the amount of acid level and how many minerals inside the water.

Im putting the PH and TDS Sensors formula below

here is the tds formula

static unsigned long analogSampleTimepoint = millis();
   if(millis()-analogSampleTimepoint > 40U)
   {
     analogSampleTimepoint = millis();
     analogBuffer[analogBufferIndex] = analogRead(TdsSensorPin);
     analogBufferIndex++;
     if(analogBufferIndex == SCOUNT) 
         analogBufferIndex = 0;
   }   
   static unsigned long printTimepoint = millis();
   if(millis()-printTimepoint > 800U)
   {
      printTimepoint = millis();
      for(copyIndex=0;copyIndex<SCOUNT;copyIndex++)
        analogBufferTemp[copyIndex]= analogBuffer[copyIndex];
      averageVoltage = getMedianNum(analogBufferTemp,SCOUNT) * (float)VREF / 1024.0;
      float compensationCoefficient=1.0+0.02*(temperature-25.0);
      float compensationVolatge=averageVoltage/compensationCoefficient;
      tdsValue=(133.42*compensationVolatge*compensationVolatge*compensationVolatge
      - 255.86*compensationVolatge*compensationVolatge + 857.39*compensationVolatge)*0.5;
      Serial.print("TDS Value:");
      Serial.print(tdsValue,0);
      Serial.println("ppm");
   }

int getMedianNum(int bArray[], int iFilterLen) 
{
      int bTab[iFilterLen];
      for (byte i = 0; i<iFilterLen; i++)
      bTab[i] = bArray[i];
      int i, j, bTemp;
      for (j = 0; j < iFilterLen - 1; j++) 
      {
      for (i = 0; i < iFilterLen - j - 1; i++) 
          {
        if (bTab[i] > bTab[i + 1]) 
            {
        bTemp = bTab[i];
            bTab[i] = bTab[i + 1];
        bTab[i + 1] = bTemp;
         }
      }
      }
      if ((iFilterLen & 1) > 0)
    bTemp = bTab[(iFilterLen - 1) / 2];
      else
    bTemp = (bTab[iFilterLen / 2] + bTab[iFilterLen / 2 - 1]) / 2;
      return bTemp;
}

and here is the PH formula

nilai_analog_PH = analogRead(ph_Pin);
  Serial.print("Nilai ADC Ph: ");
  Serial.println(nilai_analog_PH);
  TeganganPh = 3.3 / 1024.0 * nilai_analog_PH;
  Serial.print("TeganganPh: ");
  Serial.println(TeganganPh, 3);

  PH_step = (PH4 - PH7) / 3;
  Po = 7.00 + ((PH7 - TeganganPh) / PH_step);     //Po = 7.00 + ((teganganPh7 - TeganganPh) / PhStep);
  Serial.print("Nilai PH cairan: ");
  Serial.println(Po, 2);
  delay(500);

So how can i put both of the formula in one file?

Thanks for your time to answering my question.

Some speudo code

loop
{
Select pH input on the 4067
Do the pH reading
Possibly need a short delay
Select the mineral input on the 4067
Do the mineral reading
}