If cell is blank, take value from another cell

strtru

New Member
Joined
Feb 4, 2019
Messages
1
Hello all,

I am looking for a way to do this:

If a cell in a column is blank, I want to take the value from the cell to the left of that cell, and put that cell's value into another sheet. How can I do this?

Thank you for any help!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Excel 2010
AB
1405
2366
3AAA
4BBB
5274
6288
7CCC
8150
9DDD
10266

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1



Excel 2010
AB
1405
2366
3AAA
4BBB
5274
6288
7CCC
8150
9DDD
10266

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
B1=IF(Sheet1!B1<>"",Sheet1!B1,Sheet1!A1)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
Copy down Cell B1
 
Upvote 0
Hello all,

I am looking for a way to do this:

If a cell in a column is blank, I want to take the value from the cell to the left of that cell, and put that cell's value into another sheet. How can I do this?

Thank you for any help!
Hello Strtru

WELCOME to the site.
I may have something that will be of use to you, however, without knowing a few details of what you are looking for, it will be almost impossible for me to modify what I have to fit your needs. In the future, it is better for all concerned if you could give a few specific details of what you have and what your needs are. It helps us help you if we know:
1. What the sheet names are?
2. What specific cell address or columns are involved for both your source data and destination data.
3. Are you looking for an Excel formula or a VBA macro?
4. If you have any code, show it to us, even if it doesn't work.
5. If the code isn't working, where does it stop and what are the error messages?
6. It's also a big help to us if you can show us a few (even half a dozen or so) rows of your source data and what you expect the end results to be. If your data is confidential, make up some representative data. This gives us a better 'picture' of what we are dealing with.

Always keep in mind that while your needs and problems are clear to you, all we have is whatever you tell us. The more precise information we have, the faster and better we may be able to give you a solution to your problem. In most cases, it is better if you tell us something that doesn't apply or that we don't need, than it is to not tell us and then we have to write to you to get that information. With everything I've said, I'm going to make a wild guess at what you are looking for. You may have to make some adjustment as to rows, columns, and sheets. If you aren't sure how to do that, then if you can answer the questions I've asked, I'll be happy to make any changes for you. If you're looking for a VBA solution, I think I have something there too, but it will need a few modifications.

I'm assuming your original data is starting in row 2 of columns 'A' and 'B' on 'SHEET1'. If there is a blank cell in column 'B', then you want the value from 'A' of that same row transferred to column 'B', starting in row 2 of 'SHEET2'. Place the following formula in row 2 of column 'B' on SHEET2, and then copy it down as far as needed.
Code:
=IF(Sheet1!B2="",Sheet1!A2,"")
Once again, WELCOME to the site. I hope this has been of some help to you, but if not, let us know. I see that Jim May has offered a solution, however, the results of mine will be slightly different. You can pick whichever gives the end results you want.

TotallyConfused
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

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