# [SOLVED] IF statement to assign values to excel rows



## WJHamel (Sep 29, 2011)

Using Excel 2010, here's my conundrum.
I have a column, AG, that has each row assigned with a specific value, "BW, CP, VP, SU", etc. There are adjacent columns, AH through AM, who's row values need to be dictated by the corresponding value in the same row for column AG. For instance, if the value in AG3 is "BW", then the value of AH3 needs to be assigned a 1, and the values in AI3 throught AM3 need to be assigned a zero. 

I know it's an "IF" statement i need to build, but i can't get my brain around the syntax for it.

Any help is deeply appreciated.

thanks

James


----------



## RSpecianjr (Jan 20, 2010)

*Re: IF statement to assign values to excel rows*

Hey James,

Not exactly sure what you are asking... can you elaborate or give more examples?

Thanks,

Robert D. Specian Jr.


----------



## WJHamel (Sep 29, 2011)

*Re: IF statement to assign values to excel rows*

Column AG has 6,128 rows. Each row is assigned a value of either "BW", "CP", "VP", or "SU". Columns AH through AM have empty rows currently. Each row in those columns need to be assigned either a 1 or a 0 based on the value in the same row for column AG. If cell AG 3 has a value of "BW", then cell AH3 needs to be assigned a value of 1, AI3 needs a value of 0, AJ3 needs a 0, AK3 needs a 0, AL3 needs a 0, and AM3 needs a 0. If the value of AG3 is "CP", then AH3 would be assigned 0, AI3 would be 0, AJ3 would be zero, AK3 would be zero, AL3 would be 1, and AM3 would be zero. And so on.


----------



## Elkar (Mar 17, 2008)

*Re: IF statement to assign values to excel rows*

Try this:

In cell AH3 enter: =IF(AG3="BW",1,0)

In cell AL3 enter: =IF(AG3="CP",1,0)

Repeat this for each column, changing for appropriate condition. Then copy the formulas down through all 6128 rows.


----------



## WJHamel (Sep 29, 2011)

*Re: IF statement to assign values to excel rows*

Wicked-flippin-awesome!

Thanks!


----------

