# Populate data based on ranges of other data

#### Chezzo

##### New Member
Hi there,

I'm new to VBA but not to programming in general. I need to populate a cell based on another cell.

So if a cell has \$0 - \$100, the other cell needs to populate with \$.15 and another cell populates with \$15. If the cell is \$100 - \$250, the other cell populates with \$.10 and another populates with \$10.

Can someone point me to an example that does something like this?

Thanks!

#### Dannyh1

##### Well-known Member
Hi

Does it need to be code as opposed to formula?

#### Chezzo

##### New Member
Oh, no! If you can do it with formulas, by all means.

#### lenze

##### Legend
So, what is the complete scope of your Ranges?? Are there more that just these two??
lenze

#### Chezzo

##### New Member
Man, thanks! You got me thinkin' that it could be done with a formula, so I came up with this:

=IF(A1<100,0.15,IF(A1<250,0.1,IF(A1<500,0.09,IF(A1<1000,0.08,IF(A1<2000,0.07,IF(A1<4000,0.06,"BONK!"))))))

That looks at A1, and if it's less than 100, fill the cell with .15, if it's not less than 100, it looks at A1 and sees if it's less than 250... And so on.

I'll just do that in the next cell with the other data.

Thanks!