Select number from leftmost column that has one

W

widman

On a spreadsheet with 800 rows and 12 columns of data, how can I add a column
that is filled by the leftmost column that has data.
Some rows have data in only one of the 12 columns, some in 8, etc. No matter
how many there are, I only want the leftmost, no matter which column it is.
 
D

Don Guillett

Try this
sub glco()
dim i as long
for i=1 to Cells.Find(What:="*", SearchDirection:=xlPrevious).Row
cells(i,13).value=cells(i,1).end(xltoright).value
next i
end sub
 
T

T. Valko

Try this array formula** :

=INDEX(A1:L1,MATCH(TRUE,A1:L1<>"",0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.
 
W

widman

Thanks. worked like a charm

T. Valko said:
Try this array formula** :

=INDEX(A1:L1,MATCH(TRUE,A1:L1<>"",0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top