IF statements and columns

AndrePrevin

New Member
Joined
Jan 13, 2019
Messages
8
Hi all, really need your help

I have a series of values and blanks randomly distributed in one column and I want to set up a formula in the next column which looks at the first column and says, if there is a value in first column then take that value, otherwise if there is a blank then use the last cell in which a number occurred.

But where it gets a bit complicated is - I want the formula to update the value which it uses from the first column every time a new number occurs in that column, meaning that as the first column encounters a new value after a series of blanks, the formula will discard the old or previous value and take the new one

To give an idea of what I mean, column B's formula must display the last value from column A even when it encounters blanks in column A until it encounters a new value in column A at which point it must update its output to that new encountered value from column A

[TABLE="width: 500"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]

Not sure if this is even possible but I will be really grateful if some kind person could help me with this, please

Thank you
Kind regards
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi & welcome to MrExcel.
How about


Excel 2013/2016
AB
1Column AColumn B
244
34
44
522
62
72
Sheet2
Cell Formulas
RangeFormula
B2=IF(A2="",N(B1),A2)
 
Upvote 0
Hi & welcome to MrExcel.
How about

Excel 2013/2016
AB
Column AColumn B

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"]2[/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B2[/TH]
[TD="align: left"]=IF(A2="",N(B1),A2)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Thanks, I tried that but does not seem to be working for me
 
Upvote 0
does not seem to be working for me

do your columns have headers or does data start in row 1? i think Fluff's formula needs you to have a header row.
otherwise use the formula starting in row 2 and just enter the first value manually
 
Upvote 0
Can you please give an accurate sample of your data & explain why the suggestions made "do not work"
 
Upvote 0
Hi Fluff, my apologies I just realised the mistake was mine. Your formula works perfectly.
Thank you so much

If its not too much trouble, can I request your help further?
I have some more functions I need to set up in my spreadsheet

I will attach a sample workbook to make things clearer

Kind regards
 
Upvote 0
This sounds like a different question, in which case you will need to start a new thread.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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