list – How can i get the =max & =min commands in google sheets to ignore ERROR or N/A cells

I already have a list of auto generated numbers every few minutes, in which that number fluctuates, but sometimes the number is an ERROR or N/A for some reason because sheets can’t seem to get the value for sometimes.

For example my list is:

2
6
2
1
#N/A
#N/A
4
5

I want to get the max of this list so i would use the command =max(B1:B) which i’m taking the whole column. But in this situation the max will come out as #N/A, i need it to ignore the #N/A and ho straight to the highest number, in this case, 6.

As of now i’ve been manually deleting the error values, but i wanted to know if there was a better way to go about this.

That being said is there also a way to delete all the #N/A values in a single sheet with a command or such?

Note i need to take the whole column , so i can’t just do =max(B1:B4,B7:B) skipping the error values, as it’s an auto generating list and the error values are random, not sure where they will land.

Thanks and if there’s any other info needed please let me know.