# Type a value in a cell based on another cell

Closed
-
Posts
33
Registration date
Sunday June 19, 2016
Status
Contributor
Last seen
November 20, 2016
-
i need to make vba to do that
if ("A1") between 0 , 2.4 than ("B1")= 15
else if ("A1") between 2.5 , 2.9 than ("B1")= 10
else if ("A1") = 3 than ("B1")= 5
else if ("A1") more than 3 ("B1")= null
Thus, with other cells
A2 B2
A3 B2
A4 B2

I wrote This
=IF(A1=0,"15",IF(A1=0.1,"15",IF(A1=0.2,15,IF(A1=0.3,"15",IF(A1=0.4,"15",IF(A1=0.5,"15",IF(A1=0.6,"15",IF(A1=0.7,"15",IF(A1=0.8,"15",IF(A1=0.9,"15",IF(A1=1,"15",IF(A1=1.1,"15",IF(A1=1.2,"15",IF(A1=1.3,"15",IF(A1=1.4,"15",IF(A1=1.5,"15",IF(A1=1.6,"15",IF(A1=1.7,"15",IF(A1=1.8,"15",IF(A1=1.9,"15",IF(A1=2,"15",IF(A1=2.1,"15",IF(A1=2.2,"15",IF(A1=2.3,"15",IF(A1=2.4,"15",IF(A1=2.5,"10",IF(A1=2.6,"10",IF(A1=2.7,"10",IF(A1=2.8,"10",IF(A1=2.9,"10",IF(A1=3,"5",IF(A1="","0"," "))))))))))))))))))))))))))))))))

thank you very much

Posts
33
Registration date
Sunday June 19, 2016
Status
Contributor
Last seen
November 20, 2016
1
Why do you need VBA for this? Here is a regular formula...
=IF(A1>3,"",IF(A1=3,5,IF(A1>2.4,10,15)))

(also, if you are using real numbers, don't wrap them in :: it makes them text)