nothing here

NA

something like this maybe:

//global variables
uint8_t i = 0;
uint8_t threshold = 0;
unsigned long t1, df = 10000;


void setup()
{
  //whatever setup you currently have
}
void loop()
{
  int data;

  if (i < 11) {
    data = mux.read(i);

    if (data > 300) {
      if (threshold == 0) {
        t1 = millis();
        threshold = 1;
      }
      else if (millis() - t1 > df) {
        Serial.println("Threshold Detected");
        threshold = 0;
      }
    }
    else {
      ++i;
      threshold = 0;
      delay(1500);
    }
  }
  else {
    i = 0;
  }
}

It should printout only if data is above threshold for more than 10s. anything less that 10s and nothing should be printed

welcome to the forums. Please read the sticky post at the top of the page - it explains how to properly post code which helps others help you.

Basically, you want to start a timer the first time threshold is exceed and check duration if the timer is already running

unsigned long startTime;
bool timerRunning = false;
const unsigned long delayTime = 10000;

void loop()
{
  int data;

  data = mux.read(i);
  if (data > 300) {
    // above threshold, either start the timer
    // or see how long it has been this way
    if ( timerRunning == false ) {
      // start the timer
      startTime = millis();
      timerRunning = true;
    } else {
      // timer already running so check the duration
      if ( millis() - startTime >= delayTime ) {
        Serial.println("Threshold Detected");
        timerRunning = false;
      }
    }
  } else {
    // threshold too low, kill timer
    timerRunning = false;
  }
  delay(1500);
}

If you want to know that something is in a particular state for a period of time then you need to check for when it is NOT in that state. Something like this

if (data < threshold) {
   timeLastFailedThreshold = millis(); // reset the timer every time the test fails
}

if (millis() - timeLastFailedThreshold >= interval) {
     // state has been continuously over threshold throughout interval
}

…R

Or record the time on every transition from below to over-threshold, if using a state-machine approach.