If you can’t sort time values or date values correctly, you can bet that they are actually texts instead of numeric values.
Where did you get the values from? How did you enter them?
I suppose you didn’t just get AM and PM values mixed up, but also 12:30 PM
is sorted in as later than 1:30 PM
.
If the time format the texts are converted to (making text) is known to the locale of your sheet cells you can use the tool ‘Data’>‘Text to Columns…’. another way is to use the formula =TIMEVALUE(Reference) in an empty column and then to ‘Copy’/‘Paste Special…’ (values only) into the places you want them. The numeric values can then be displayed in any ‘Numbers’ format.
After that you can apply a format anew. You may want to consider using an internationally standardised format like “HH:MM:SS” or “HH:MM” and abandon the misleading AM/PM. In international formats times sort correctly even if they are texts.