简体   繁体   中英

Using an Excel formula to select a date based on a separate populated cell

I need a formula that'll automatically populate the End Date column (see screenshot below) with the corresponding end date on the right hand side. For example for row 7 the End Date would be 08-oct since the rightmost populated cell for that row falls under the date column 08-oct.

I realise for rows 5 and 6 there is only one populated cell, so I'm guessing by default the formula will take the date there as the End Date, even though that's technically the Start Date. That's OK.

Please ignore the numbers, eg 0.5, 2.0, they just represent the number of resources on that phase of the project. I just need the formula to look through that row of cells, choose the rightmost one that is not empty and then take the date in that cell's column header.

在此处输入图片说明

Much appreciated and thanks in advance!!

Pete

So in B3, for example, assuming your header dates are in row 2 (not merged cells otherwise row 1)

=INDEX($2:$2,,MATCH(99^99,3:3))

You can then drag down. It looks to find where the last cell with a number in is within the specified row. The number it returns is used to index into the header row to return the corresponding date.

B3=LOOKUP(2,1/(3:3>0),$2:$2)

Was thinking more belt and braces so i used

 =IFS(O2<>"",$O$1,N2<>"",$N$1,M2<>"",$M$1,L2<>"",$L$1,K2<>"",$K$1,J2<>"",$J$1,I2<>"",$I$1,H2<>"",$H$1,G2<>"",$G$1,F2<>"",$F$1,E2<>"",$E$1,D2<>"",$D$1,C2<>"",$C$1)

for row 2 end date

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM