If this then that, but if not that then this

MattTom

New Member
Joined
Mar 29, 2018
Messages
8
A
B
C
1
Month
Data
2
Aug
3
July
4
June
6.12

<tbody>
</tbody>

I'm trying to write a formula that will pull in the most recent data if available. So if C2 is empty, it will return C3, but if C3 is empty it will return C4. Thus, the formula would yield 6.12 in the example above.

Any help would be greatly appreciated!













<colgroup><col width="96" style="width: 72pt; mso-width-source: userset; mso-width-alt: 3510;"><colgroup><col width="67" style="width: 50pt; mso-width-source: userset; mso-width-alt: 2450;"><tbody>
</tbody>
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
If the values in column C are numbers formatted as dates then try this:
=MAX(C2:C100)

which returns the latest date in that range
 
Last edited:
Upvote 0
=INDEX(B1:B20, MIN(IF(B1:B20<>0, ROW(B1:B20))))
entered as an array formula with Ctrl+Shift+Enter

Edit:
=INDEX(B1:B20, MIN(IF(ISNUMBER(B1:B20), ROW(B1:B20))))
might be better if you have zero values
 
Last edited:
Upvote 0
=INDEX(B1:B20, MIN(IF(B1:B20<>0, ROW(B1:B20))))
entered as an array formula with Ctrl+Shift+Enter

Edit:
=INDEX(B1:B20, MIN(IF(ISNUMBER(B1:B20), ROW(B1:B20))))
might be better if you have zero values

Hi Scott. Thanks for the reply!

In your formula you're referencing the date column. Is it possible to only reference the data column (C) to pull in the contents of the first non-blank cell? FYI there won't be zero values.

Thanks!
 
Upvote 0
Just substitute C's for the B's in my formula.

I swapped the C's for B's, but I'm getting #REF ! (entered via ctrl/alt/enter). Keep in mind that my data series goes back 10+ years (instead of just the 3 months in my example).

Also, I have multiple sets of data. Some series may have a June value, while others may have a July or August value. My goal is to pull the most recent data point for each series.
 
Upvote 0

Forum statistics

Threads
1,215,948
Messages
6,127,871
Members
449,410
Latest member
adunn_23

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