How to use SUMIF to exclude cells that contain empty strings?

How can I use SUMIF to exclude cells whose criteria cells contain empty strings? For example:

A1 contains 100
A2 contains "" (an empty string, not a blank cell)
B1 contains 50
B2 contains 75

I want to sum B1:B2, but only for those cells where A1:A2 is not an empty string. The desired result in this case is 50. However =SUMIF(A1:A2,"<>''",B1:B2) returns 125. This is surprising, because =IF(A1<>"",TRUE,FALSE) returns TRUE and =IF(A2<>"",TRUE,FALSE) returns FALSE.

How can I obtain the desired result? Thank you.

[erAck: edited to properly code-quote to display actual quote characters instead of typographic quotes]

It may sound counterintuitive, but just try =SUMIF(A1:A2;"<>";B1:B2)

It certainly is counterintuitive, but it works, so I can’t complain! Thank you.

Is it OK that the formula also excludes blank cells?

In this case, it is okay. Thank you for pointing that out, though.