Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Setting one Column's Value Based On Another Column

I have a "pair" of columns that exist in many different spreadsheets that
our group receives data in. They are always in the same order, but not
always in the actual columns, i.e. compo is always the column just before
curorg, but they don't always live in columns D and E. What I need to do is
set the value of compo based on curorg. I was trying to modify a macro given
to me for cleaning up ssn's with missing leading zeros. In other words I
would like to just select the two columns and have whatever is already in
compo replaced with the proper value, if curorg is a 1 or S or U then set
compo to '1, and so forth. There are currently 19 values that could exist in
curorg and 3 values ('1, '2, '3) that would map to those curorg's and be
inserted into the compo column.

I hope this makes sense.

Bruce



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Setting one Column's Value Based On Another Column

Bruce,

No, it doesn't make sense - or, at least, your question isn't clear. Post a small example of the
table before and the table after, and that will help us help you.

HTH,
Bernie
MS Excel MVP


"Bruce Martin" wrote in message ...
I have a "pair" of columns that exist in many different spreadsheets that our group receives data
in. They are always in the same order, but not always in the actual columns, i.e. compo is always
the column just before curorg, but they don't always live in columns D and E. What I need to do is
set the value of compo based on curorg. I was trying to modify a macro given to me for cleaning up
ssn's with missing leading zeros. In other words I would like to just select the two columns and
have whatever is already in compo replaced with the proper value, if curorg is a 1 or S or U then
set compo to '1, and so forth. There are currently 19 values that could exist in curorg and 3
values ('1, '2, '3) that would map to those curorg's and be inserted into the compo column.

I hope this makes sense.

Bruce





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Setting one Column's Value Based On Another Column

Bruce,

Sounds like you are trying to locate the column number for "compo"

If "compo" is a header and headers are on row 1

Dim col as Long

col = worksheetfunction.Match("compo"),Rows(1),0)

Use caution - if compo isn't there - the match function will return an
error.

once you have the column number - you can build your code...

--
steveB

Remove "AYN" from email to respond
"Bruce Martin" wrote in message
...
I have a "pair" of columns that exist in many different spreadsheets that
our group receives data in. They are always in the same order, but not
always in the actual columns, i.e. compo is always the column just before
curorg, but they don't always live in columns D and E. What I need to do is
set the value of compo based on curorg. I was trying to modify a macro
given to me for cleaning up ssn's with missing leading zeros. In other
words I would like to just select the two columns and have whatever is
already in compo replaced with the proper value, if curorg is a 1 or S or U
then set compo to '1, and so forth. There are currently 19 values that
could exist in curorg and 3 values ('1, '2, '3) that would map to those
curorg's and be inserted into the compo column.

I hope this makes sense.

Bruce





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a report sheet based on 1 column's data dunnowhatimdoin Excel Worksheet Functions 1 September 18th 10 10:08 AM
AVERAGE a range in a column if another column's range equals a val bob$ Excel Discussion (Misc queries) 3 February 24th 09 07:42 AM
How to specify 2nd column data depending on 1st column's data? Eleanor Excel Discussion (Misc queries) 1 February 13th 07 05:43 PM
How to lookup row # based on content of another column's cell Mr. Jan Park Excel Worksheet Functions 7 November 2nd 05 12:58 AM
setting column value based on if statement Brian Shafer[_2_] Excel Programming 2 November 14th 04 03:28 PM


All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"