Wednesday, 15 June 2011

excel - Fill out a coulumn based on 2 other colums -



excel - Fill out a coulumn based on 2 other colums -

i trying build macro allow me automatically fill out cells in column based on 2 criteria, county , project type, both of own column names. column filled out called "frequency band", have static range of 12 possible values. example, if county "bergen" , project type "2", frequency band "800mhz". if same county (bergen) project type "3", frequency band "1900mhz". have list of frequency bands listed in worksheet (just phone call sheet 2, cells e2 – e13), imagine outline of vba code like:

if county(a) = lee , project type(b) = 2 frequency band(c) = 800mhz(e3) else if project type = 3 frequency band = 1900mhz

etc., etc. each county since i’ve never coded in vba before , have no thought of syntax, don't know begin formula this. help me started?

here 1 way work formula.

in cells g1:k6 there table stored info (could on sheet)

column set in country, column b set in project type (would if validated against source data.

column c lookup function

'=index($h$2:$k$6,match(a2,$g$2:$g$6,0),match(b2,$h$1:$k$1,0))

index takes 3 main inputs:

the array (h2:k6) actual frequency values row number in array, , column number in array

for row number lookup country in list have (g2:g6) , tell x number in array corresponds row in index array

same thing column , project type.

there ton of info on net index , match if need more information.

highlighing show values formula has picked in 3 examples below.

excel excel-vba

No comments:

Post a Comment