Welcome to VBForums
To start with I would recommend thinking about what the code will actually do in various situations. Taking the first part:
..If txtValue1 is 0 or empty, the only code that can run is the next If statement, so you will only get a result if txtRiceB is also 0 or empty.
If Val(txtValue1.Text) = "0" Or Len(txtValue1.Text) = 0 Then
If Val(txtRiceB.Text) = "0" Or Len(txtRiceB.Text) = 0 Then
txtAvgRice.Text = Val(txtRiceC.Text)
ElseIf Val(txtValue1.Text) = "0" Or Len(txtValue1.Text) = 0 Then
Similar applies to the other code too, but why bother with such a complicated arrangement? Instead of trying to check each possible permutation as a whole, just deal with each part, and do the calculation at the end.
All you really need is two variables (a total, and a count), and three If statements, eg:
Note also that there is no point checking both parts of Val(txtValue1.Text) = 0 Or Len(txtValue1.Text) = 0 , because the Val part by itself will produce the same overall result.
Dim sngTotal as Single
Dim intCount as Integer
If Not(Val(txtValue1.Text) = 0 Or Len(txtValue1.Text) = 0) Then
sngTotal = sngTotal + Val(txtValue1.Text)
intCount = intCount + 1
If intCount > 0 Then
txtAvgRice.Text = Round(sngTotal / intCount ,2)