formula for first nonblank cell

kimm199

New Member
Joined
Jul 27, 2011
Messages
8
Hi,

I have a spreadsheet where the rows are names and the columns are dates. For each column (each date) the number 1 is entered if the person is present, it is left blank if they are not. I need two formulas (not a macro please!) that I can insert into Column B and C respectively, that automatically finds the date corresponding with the person's first and last day present. Maybe it can be a formula showing the date (as entered in row 1) that corresponds to the first non-blank cell in that row?

Thanks!

Kim
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Kim,

Welcome to MrExcel!!

Assuming the names are in Col A and the present flag (i.e. 1) is in the range $B$1:$B50 (change the 50 to suit), try these;

Col A value of first 1 found:

=INDIRECT("A"&MATCH(MIN($B$1:$B50),$B$1:$B50,0))

Col A value of last 1 found:

=INDIRECT("A" & MATCH(1,$B$1:$B50))

Though I'm sure there's other ways to achieve the same, these will do the job.

HTH

Robert
 
Upvote 0
Hi,

I have a spreadsheet where the rows are names and the columns are dates. For each column (each date) the number 1 is entered if the person is present, it is left blank if they are not. I need two formulas (not a macro please!) that I can insert into Column B and C respectively, that automatically finds the date corresponding with the person's first and last day present. Maybe it can be a formula showing the date (as entered in row 1) that corresponds to the first non-blank cell in that row?

Thanks!

Kim
Try these...

Book1
DEFGH
17/1/20117/2/20117/3/20117/4/20117/5/2011
2_111_
Sheet3

For the first date:

=INDEX(D1:H1,MATCH(1,D2:H2,0))

Format as Date

For the last date:

=INDEX(D1:H1,MATCH(2,D2:H2))

Format as Date
 
Upvote 0
Try this in B2:
Code:
=INDEX($D$1:$K$1,MATCH(1,$D$2:$K$2,0))
In C2:
Code:
=LOOKUP(2,$D$2:$K$2,$D$1:$K$1)
untitled-1.jpg
 
Upvote 0
Great! Thank you! This worked the best for what I was trying to do:

arrival date: =INDEX($D$1:$AA$1,MATCH(1,D2:AA2,0))
departure date: =INDEX($D$1:$AA$1,MATCH(2,D2:AA2))

Cheers!!!
 
Upvote 0
Great! Thank you! This worked the best for what I was trying to do:

arrival date: =INDEX($D$1:$AA$1,MATCH(1,D2:AA2,0))
departure date: =INDEX($D$1:$AA$1,MATCH(2,D2:AA2))

Cheers!!!
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

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