Address columns programmatically

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,912
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
  8. 2003 or older
Platform
  1. Windows
If I have for example 4 columns C1,C2,C4,C3
Can I address them within code as C[variable] where variable is calculated and within the range 1 to 4
If x=y then C[variable] = C[variable] + 1
 
Yes, but how depends on what you are trying to do. You can use Record.Field for example to refer to a spcific column in a row by name.
 
Upvote 0
I am trying to think of a way of tallying up tasks by userid the tasks can be in any order and not necessarily present
In my real life situation there might be 10 possible tasks so I might want to end up merging/concat these columns to produce
1110010011 where 1 is complete 0 not
Grouping by userid is the easy bit
 
Upvote 0
Sounds like you should probably be unpivoting those columns.
 
Upvote 0

Forum statistics

Threads
1,226,798
Messages
6,193,065
Members
453,773
Latest member
bclever07

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top