Subtracting Column B From A, How To Leave Third Column Blank If No Value In Column B?

Hello - I have what is proabably a basic question, but I could not find the answer. I have a spreadsheet with three columns (A,B,C). I want the third column C to be column A - B (A minus B) for each row, but only if there is a value in column B. If there is no value in column B, then I want that row in Column C to just stay blank. Is this possible? Thank you.

Free Excel Help Forum

- Ask any question about Excel and have it answered in no time.

Similar Excel Tutorials

Get the Row or Column Number of a Cell in Excel
How to get the row or column number of the current cell or any other cell in Excel. This tutorial covers important ...
Find the Next Blank Row with VBA Macros in Excel
Learn how to find the next empty cell in a range in Excel using VBA and Macros.  This method will skip any blanks ...
How to Add, Remove, and Rearrange Columns and Rows in Excel
Adding, removing and rearranging columns is as easy as resizing. You just select your columns or rows, right click ...
Delete All Empty Rows or Blank Cells from a Range in Excel
How to quickly delete all empty cells or rows from a range in Excel.  This allows you to quickly clean your data to ...

Helpful Excel Macros

Reverse Row or Column Order in a Worksheet
- This macro reverses the order of a selected row or column in excel. It will completely reverse the data.
Highlight the Column of the Selected Cell
- This macro will highlight the column of the active cell. This will fill the column of the active cell with a solid back
Highlight the Row and Column of the Selected Cell
- This macro will highlight the row and column of the active cell. This will fill the column and row of the active cell w
Delete Blank Rows in Excel
- This is a macro which will delete blank rows in excel. This version will delete an entire row if there is a blank cell
Vlookup Macro to Return All Matching Results and Stack them with Previous Results
- This is very similar to the other Vlookup type Macro in that it returns all of the results that match a particular se

Similar Topics

I have two columns in my spreadsheet. Column A has no blank fields, Column B has some blank fields. I would like to show the text from Column A in the same row of Column B only when Column B is blank.

So, basically I'm after: If column B has text, do nothing. If column B is blank, then list text from Column A.

Right now I've created Column C with this formula =IF(ISBLANK(B1), A1. That's working to get the text from A1 when B1 is blank. What can I do/add to get it pull the text from B1 if there is text there? there a better approach altogether?

I have a project I am working on for work. It involves 3 columns: Column A is the person's name, Column B is the computer name of the user submitted by the user, and Column C is the computer name of the user as provided from a report. Some users left Column B blank so we ran the report in Column C to try to fill in the blank cells. I need to merge columns B and C. I want to merge the columns so that column C is the "master" column and column B only fills in the blank cells of column C.

I have read through about a dozen posts about merging columns but I could not find one where one column is a "master" column that is not overwritten unless there are blank cells.

Any help would be greatly appreciated.


I have a question regarding filtering of columns, hopefully someone is able to put me on the right track. I have set up Excel 2007 so that I can click on the drop-down menu in each column to filter them.

However, in my data set there is one blank row separating two set of rows. Now, when I apply the filter on a column, all the rows above the blank row filter correctly, but all the rows below stay un-filtered.

I guess Excel only looks at the consequtive rows, then stops when it hits a blank row. Is there any way of applying the filter beyond a blank row (i.e. the whole column)?

Any advice is higly appreciated.

I am new to the forum but have found some helpful stuff here so far.

I have a project that I am working on and have over 68 thousand records that have all the data in one column that I need to get into multiple columns. The good thing is each record is broken up by a blank row but some records could have 1 line or 6 lines that I need to move to columns. If there is only 1 row then it goes to column 6, 2 rows then they go to column 5 and 6, 3 lines column 4, 5 and 6...etc.

<blank row>
<blank row>
<blank row>

Desired result:
Column 1 Column 2 Column 3
this didnt come out right. if i need to i can poste the spreadsheet


Forgive me if I've posted in the wrong place I'm new I looked around couldn't find my answer and felt this was the correct place to post my question.

Column A




This is basiclly what I'm looking for sure I could just =SUM(A1:A4) but then if I move things around I have to change the forumla. What I'm looking for is like a conditional SUM where I sum column A until I find a blank value. Is this possible?

I am using Excel 2003 and I need to sort and match three columns:

Column A:
Column B
Column C

About Column A:
Column A contains 40 rows of data (numerical codes in each cell). I would like to sort Column B and Column C according to the sequence of data in Column A. For instance, if there is a cell with 17685 in Column A, I want the 17685 in Column B to line up in the same row as it appears in Column A, and for the corresponding value in C (which is referenced to Column B but not the same type of numerical code as Column A or Column B) to also line up. When there is no match in Column B for a cell in Column A, I want to see a blank cell in Column B.

About Column B:
Column B contains 33 rows of data, all of which also exist in Column A but they are not currently aligned with those numbers in Column A. Further, Column B has fewer rows than Column A and I need Column B to display blank cells where there is no match with Column A.

About Column C:
Column C contains 33 rows of data, none of which contain the data/numbers in Column A and Column B, but which should be referenced to cells in Column B.

I have tried to use the sort function but have not been able to achieve what I want. I sense it must be very simple but I cannot get the three columns to line up (with blank cells) as I need them. I would be very grateful for any help. Thank you very much.


I have a spreadsheet with values that change each day which currently requires a lot of manual manipulation. Part of the manipulation involves removing from a row any negative value in which there is no preceeding positive amount.

For example, column A is blank, column B is blank, column C is -$100, column D is $100, column E is -$100. I need to remove the -$100 from column C but leave the other values. The problem with using a macro is the value in any given cell will not be the same from day to day, so telling it to delete the value in C3 won't always be right.

I do it now by filtering the first column on any value less than 0, delete all those items, then change the filter to blank, move to the next column and repeat, the next column repeat, etc.

Is there a macro that can be made smart enough to selectively delete data based on this logic? I've also tried to do this same thing in Access but am unable to get it to work there, either.

Thanks for any help.

Hello all,

I am having the following situation.

Column A has different values and some rows are blank.

I want in Column B to check the equivalent cell in column A and work its way upwards until it finds a numerical value, then show that value.

So for example I have this


I want in column something like IF(A3="",xxxxx,"") where xxxx is the formula that looks up column A starting from A3 upwards and when it finds the value (i.e in this case "1") to show that value.

I hope I'm making sense.

Regards and thanx for any answers.


hello I am an excel noob as this question will show
Here is my situation; I have a worksheet that work orders are entered on sheet 1, in column the date last modified. Daily the number of orders changes from 10 to 100. On sheet2 I pull only three of the columns including column N and then do conditional format to change the color to red dates that are older then today. Since I do not know how many there will be in column N I put ="sheet1"!N1 and did that to N100 but the blank ones show as 1/0/00 and I would like to know how to leave it blank if it is blank on sheet1.
Thanks in advance,


I am looking for a Macro that will search a column for blank cells, and when one is found will add text to the same row in another column. For example: The below is a spreadsheet. I am trying to find something that will search through column "C" in this case and add text (of my choice) to Column "A" if the cell is Blank. So Since cell C1 is Blank then Type "ERROR" is cell A1.

   A B C D E
1 X X    X X
2 X X    X X
3 X X X X X
4 X X X    X
5 X X X X


hi guys

I made the following running balance

column A is deposits
column B is withdrawal
Column C is balance

i used the following formulas

C1 =SUM(A1,-B1)
C2 =SUM(C1,A2-B2)
C3 =SUM(C2,A3,-B3)

Column C keep showing balance data even if A2, B2 are empty.

I am unable to find a formula for C3, C4 etc to stay blank until value gets entered in (A2 or B2) (A3 or B3) etc.

thanks again as this is great help

Hey everyone. I am new to this forum but have been trying to find my answer and have not been successful. I have tried some of the other answers and have not been able to accomplish anything. This is what I am trying to do.. Say in column B I need to look at all rows in B to see if a value matches "residential" if it does I need to then copy the value from column H where column B was equal to Residential and I need this to be copied into another Sheet.... I need the value in Column H to be copied to Sheet 2 in Column C. I I have used this =IF(Sheet1!B:B="Residential",Sheet2!H:H,) but that will leave a 0 for all that are not equal and leave blank rows. I do not want blank rows. I have attached a copy. Thanks.

Hello everyone!

I would like to see if you can help me with this that I cannot manage to deal with it...

I have a macro that (thanks to Alpha Frog) consolidates and summarizes the debts and pastes this into a new spreadsheet. Then, I would like to put formulas on column H that will differentiate amounts of 10 or less, 10 or more... but only paste formulas UNTIL the last cell is blank... because I can receive one day 10 debts and another day 20... so to populate until there's no more data on the sheet...

Column A has the name
Column B the account
Col C other data
Column D has the Amount

I would like to input on Column H: =IF(D3

Hi, Can anyone help me with this?

I need to copy column B to Column E.

In column B are numbers that are generated from a database and there are blank spaces between them. I would like to copy them to Column E but leave out the blank spaces.

Can this be done with any formula , trick or VBA ?

Thank you very much. Tweek.

I have several columns each with numbers and blank spaces I like that I could sum this columns horizontally and make a total column and that the result of blanks sum still blank, that because each rows refers to a code, so I need to keep blanks and just sum horizontally.

So I made a conditional, it works fine, however I like to go by with contrl+down so I can stop at each existence, but since there is conditional it take me from beggining to end of column without stoping at numbers.

I ctrl+c ctrl+v the hole column and just pasted values, the conditional is gone, the blank cells look blank but excel recognizes them as constants, meaning ctrl+down stiil take me from begining to end.

Sorry for my eanglish, I already posted this same question in spanish, just hoping to recibe a faster answer.


Hello all,

I am trying to create a macro that will delete the entire row if column A contains non-numeric data or is blank.
I am importing data from a different spreadsheet that has column headers or sometimes is blank in column A but contains data in other columns. So I would like to only keep the row if column A contains numeric data.

Your help is greatly appreciated.

I have 3 columns in excel that I need to convert .prn text file. The first 2 have data, the third is blank. In order for the .prn file to work properly, I need it to include the third column which is blank. I cannot find a way to do this. I've got a macro to convert my file to .prn file but it only includes the first two columns which has a total byte length of 20. The third blank column has an additional 10 bytes of width that I need to somehow get onto the .prn file. Any suggestions would be greatly appreciated.

Hi, i'm using excel to create a spreadsheet to keep a track of my accounts but am struggling to come up with a formula which is probably really simple but i just can't seem to get in right.

I have a credit column, a debit column & a total column.

I want the total column to minus what is in the debit column (column E) & add what is in the Credit column (column D).

This os driving me insane as I use excel quite a lot but can't do this...heeeelp!!!


I am trying to ignore blank cells in a certain column. Columns A and B contain data. Column A contains number between 2 and 11, and column B contains measured data.
The formula I am using is as follows:


This formula goes on using 2 to 11 in the logic test statement and takes the variance. But, if one of the cells is blank in the B column, an error occurs in the IF statement evaluation, leading to an error as the final answer.
This workbook will be used by others, and there is no way to predetermine which cells will be blank when data is pasted into the worksheet.


Hi All
Can anyone help me please?

I have a Listview control with 3 columns.

I have written a function that totals Column 2 values.
However, I cannot find how I add this result to the end of all items in Column

i.e. if column 2 data is:-


The end of column 2 would display 14 (ideally, with a blank row before the total entry)

Thank you in advance.

I have a worksheet that we'll call "Main". I this worksheet, there are 12 columns.

Of those 12 columns, A thru L, I need to separate them out into separate based on 20 distinct values that can appear (multiple times or none at all for each value) in column B. (Note: If it would make it easier, I can re-arrange to make Column A the column with the criteria to sort these by. It would be a pain, but I can do it.)

Based on what is in Column B, I need the workbook to be sorted into the distinct subset workbooks, pulling only columns B, C, and G from the original. (The rest of the columns are used elsewhere in the workbook for calculations, so I need them to stay in the "Main" sheet, but I don't need them in the subset workbooks.
I further need it to not only sort these into individual workbooks based on column B, but also to only grab those rows that have a set value ("2" in my workbook) in column J...even though column J is not itself one that needs to be copied's only a criteria determining what is copied.

Can this be done? I know I can do it with a combination of If statement and Vlookup, but if I do it that way, then any rows that don't qualify to be sorted into a particular workbook instead show up blank, so my data comes out with blank row, blank row, blank row, row with data (it qualifed with the if/vlookup), blank row, blank row, data row, etc.

My "Main" sheet usually has somewhere around 1,000 rows, and I have 20 different sheets to sort it into. I have to do this weekly, so I'm not inclined to sort/filter/copy/paste every time I need the report published.

Any help will be greatly appreciated.

I can't post an example because I don't have the necessary permissions to install anything (including the program to display worksheets) onto my computer. I can send you an example if you'd like, as I know that's an incredibly complicated question...and more complicated with no example.



I have to columns

Column H = Department
Column I = Group

Some cells in column H are blank, some cells in column I are blank. I want to test for blanks and:

1. If cell in column H not blank, show contents, else "No Department"
2. If cell in column I not blank, show contents, else "No Group"
3. If both cells in columns H and I blank, show "No Data"

I have written the formulation below, individual parts work but not this combination, ie results column J, Union. Would appreciate any help to understand what I am doing wrong when combine.

=IF(H2="","No Dept",IF(I2="","No Group",IF(H2:I2="","No Data",CONCATENATE(H2,": ",I2))))

Department Group Union
Big Small #VALUE!
Hi Low #VALUE!
Black White #VALUE!
Oil Water #VALUE!

Any help on this would be much appreciated.

I've tried many didn't formulas however I keep returning to:


In the 'C' column on sheet 1 zip codes will be entered, on sheet 2, column 'B' is a list of zip codes. This formula states a 'YES' if the zip code is not found and a 'NO' if it is. The problem with it is if the 'C' column is blank it shows the 'YES' answer, which I don't want.

Is there a change I can make to the formula to have it show no answer if the 'C' cell is blank?

Thank you so very much in advance, I'm pulling my hair out trying to get this to work properly.


I've tried countless time to try and solve my problem, however I'm finally admitting defeat. Can someone please take a look at my problem and offer advice on how to solve this.

Basically I have data in column B (for example of this) and i want to copy each cell to the next blank cell below in column A.

So far everything I've tried has led me to only being able to copy to a preset offset value.

I've been trying to select each cell individually (B2), then offset it to the previous column, if that's not blank, then try the next row, until there's a blank, then copy, and go to the next cell (B3) and so on.

The attached show a before and after of what I'm trying to achieve.

I'm also looking to move further data (6 connecting columns) in the same way. Can you also please specify any slight changes I may need to implement other than the range.

Thanks in advance for all your help.

I have a spreadsheet with sku's in Column A. Some are duplicated 3-4 times, others are used only once.
In column B I have the sku's description. For those with multiple instances in Column A they have different descriptions in Column B.

I would like to automatically find duplicate Column A cells and then have it Concatenate the Column B cells to the first instance of the Column A sku number.

I found an answer using the MCONCAT (

Problem is that this answer requires me to manually enter each sku number, as in "D1", (if I understand it correctly).

I have 6500 different sku numbers. Too many for that answer.

Any other ways to automate this?

I'm not all that "techie". A new pup still learning to walk.