bjk571:
There is a similar example on this page, only difference; "Delay added"
https://www.instructables.com/id/Arduino-Lcd-Counter
if (button == HIGH) {
a ++;
lcd.setCursor(3, 1);
lcd.print(a);
delay(200);
}
Oh dear! You swore! "Instructables"! An offensive word on this forum! 
Your code is already superior to that.
Here is code to completely de-bounce four buttons. It is to implement the "Radio Buttons" function where each button turns its own LED on and all the others off.
The de-bounce "interval" is set to 10 milliseconds which means that it will respond ten milliseconds after the input stops bouncing rather than when the button is released, and will not respond further until ten milliseconds after the input stops bouncing on release, but will not impede any other operation while it waits for any de-bouncing. Note that it never uses the delay() or while() functions.
It is easily modified to do whatever else you need to do, such as counting:
// Radio Buttons!
const int led1Pin = 3; // LED pin number
const int button1 = 2;
const int led2Pin = 5;
const int button2 = 4;
const int led3Pin = 6;
const int button3 = 7;
const int led4Pin = 9;
const int button4 = 8;
char bstate1 = 0;
char bstate2 = 0;
char bstate3 = 0;
char bstate4 = 0;
unsigned long bcount1 = 0; // button debounce timer. Replicate as necessary.
unsigned long bcount2 = 0;
unsigned long bcount3 = 0;
unsigned long bcount4 = 0;
// Have we completed the specified interval since last confirmed event?
// "marker" chooses which counter to check
// Routines by Paul__B of Arduino Forum
boolean timeout(unsigned long *marker, unsigned long interval) {
if (millis() - *marker >= interval) {
*marker += interval; // move on ready for next interval
return true;
}
else return false;
}
// Deal with a button read; true if button pressed and debounced is a new event
// Uses reading of button input, debounce store, state store and debounce interval.
// Routines by Paul__B of Arduino Forum
boolean butndown(char button, unsigned long *marker, char *butnstate, unsigned long interval) {
switch (*butnstate) { // Odd states if was pressed, >= 2 if debounce in progress
case 0: // Button up so far,
if (button == HIGH) return false; // Nothing happening!
else {
*butnstate = 2; // record that is now pressed
*marker = millis(); // note when was pressed
return false; // and move on
}
case 1: // Button down so far,
if (button == LOW) return false; // Nothing happening!
else {
*butnstate = 3; // record that is now released
*marker = millis(); // note when was released
return false; // and move on
}
case 2: // Button was up, now down.
if (button == HIGH) {
*butnstate = 0; // no, not debounced; revert the state
return false; // False alarm!
}
else {
if (millis() - *marker >= interval) {
*butnstate = 1; // jackpot! update the state
return true; // because we have the desired event!
}
else
return false; // not done yet; just move on
}
case 3: // Button was down, now up.
if (button == LOW) {
*butnstate = 1; // no, not debounced; revert the state
return false; // False alarm!
}
else {
if (millis() - *marker >= interval) {
*butnstate = 0; // Debounced; update the state
return false; // but it is not the event we want
}
else
return false; // not done yet; just move on
}
default: // Error; recover anyway
{
*butnstate = 0;
return false; // Definitely false!
}
}
}
void setup() {
pinMode(led1Pin, OUTPUT);
pinMode(button1, INPUT_PULLUP);
pinMode(led2Pin, OUTPUT);
pinMode(button2, INPUT_PULLUP);
pinMode(led3Pin, OUTPUT);
pinMode(button3, INPUT_PULLUP);
pinMode(led4Pin, OUTPUT);
pinMode(button4, INPUT_PULLUP);
digitalWrite (led1Pin, LOW);
digitalWrite (led2Pin, LOW);
digitalWrite (led3Pin, LOW);
digitalWrite (led4Pin, LOW);
}
void loop() {
// Select LED if button debounced
if (butndown(digitalRead(button1), &bcount1, &bstate1, 10UL )) {
digitalWrite (led1Pin, HIGH);
digitalWrite (led2Pin, LOW);
digitalWrite (led3Pin, LOW);
digitalWrite (led4Pin, LOW);
}
// Select LED if button debounced
if (butndown(digitalRead(button2), &bcount2, &bstate2, 10UL )) {
digitalWrite (led1Pin, LOW);
digitalWrite (led2Pin, HIGH);
digitalWrite (led3Pin, LOW);
digitalWrite (led4Pin, LOW);
}
// Select LED if button debounced
if (butndown(digitalRead(button3), &bcount3, &bstate3, 10UL )) {
digitalWrite (led1Pin, LOW);
digitalWrite (led2Pin, LOW);
digitalWrite (led3Pin, HIGH);
digitalWrite (led4Pin, LOW);
}
if (butndown(digitalRead(button4), &bcount4, &bstate4, 10UL )) {
// Select LED if button debounced
digitalWrite (led1Pin, LOW);
digitalWrite (led2Pin, LOW);
digitalWrite (led3Pin, LOW);
digitalWrite (led4Pin, HIGH);
}
}