If this then that, but if not that then this

MattTom

New Member
Joined
Mar 29, 2018
Messages
8
[TABLE="width: 200"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Month
[/TD]
[TD]Data
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Aug
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]June
[/TD]
[TD]6.12
[/TD]
[/TR]
</tbody>[/TABLE]

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!








[TABLE="width: 122"]
<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>[TR]
[TD="width: 96, bgcolor: transparent"][/TD]
[TD="width: 67, bgcolor: transparent"]
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]
[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]
[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]
[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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