I need a formula to put in cell C3 that says: If cell A1 > 0, then it equals cell B2 (but if it's blank, it equals 0)

thefreestove

New Member
Joined
Nov 6, 2017
Messages
6
I hope this makes sense?

I'm creating a budget for a tour company that occasionally use bus drivers. I want the formula in C3 to reference cells A1 and B2. If the number of bus drivers (cell A1) is greater than 0 - then I need to add the accommodation costs (from cell B2) to the vehicles budget.

Hope this helps:

A1 = Number of Bus drivers
B2 = Price of Accommodation
C3 = Formula I'm seeking (I only want the price of accommodation to be included IF we are using a bus driver - otherwise the cell should remain blank)

Many thanks in advance - I've been trying for ages without any luck.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
@thefreestove, we all learned whatever we learned at some point. Keep asking. And glad it worked out.

Aladin's suggested formula will also work; and, if you have any reason to believe that someone might enter a space into A1 rather than deleting it or putting a zero, his formula would take care of those instances too.
 
Upvote 0
Thank You, Aladin. ErikTyler just informed me that your formula would also work if someone accidentally hit a space bar... so with that in mind - is there a formula prefix/extension that I can add to all of my other formulas that would also address this problem?

For example, I have a simple formula: =C34*(C35*C36) But if there was a space bar in C34, then it returns a #VALUE ! (whereas the cells containing your super-formula just show 0) - this could be a lifesaver as the main user of my spreadsheet is someone not very experienced with Excel, and I could just imagine them hitting a space bar and destroying formulas

Thank you
 
Upvote 0
Thank You, Aladin. ErikTyler just informed me that your formula would also work if someone accidentally hit a space bar... so with that in mind - is there a formula prefix/extension that I can add to all of my other formulas that would also address this problem?

For example, I have a simple formula: =C34*(C35*C36) But if there was a space bar in C34, then it returns a #VALUE ! (whereas the cells containing your super-formula just show 0) - this could be a lifesaver as the main user of my spreadsheet is someone not very experienced with Excel, and I could just imagine them hitting a space bar and destroying formulas

Thank you

You can either

=IF(ISNUMBER(C34*(C35*C36)),C34*(C35*C36),"no value")

or

=IFERROR(C34*(C35*C36),"no value")

It might be the case that the first one is a tad faster.

By the way, destroying a formula by hitting a space cannot be counteracted by a formula. Rather have look at the protection functionality under the Review tab of Excel.
 
Upvote 0
Hello Aladin,

I received an email that you tried to send me a message, but it was not delivered to my inbox as I'm only allowed 1 pm.

The request was:

If there's an error in C37 and/or $E$7 replace with "$0" and also divide E44 by $E$7 (all in the one formula) - is this possible?

Thank you
 
Upvote 0
Hello Aladin,

I received an email that you tried to send me a message, but it was not delivered to my inbox as I'm only allowed 1 pm.

The request was:

If there's an error in C37 and/or $E$7 replace with "$0" and also divide E44 by $E$7 (all in the one formula) - is this possible?

Thank you

Replace what with 0 when C37 and/or $E$7 contain an error?

Must C27 be included in the final formula which meeds to divide E44 by $E$7? If yes, how?
 
Upvote 0

Forum statistics

Threads
1,215,315
Messages
6,124,207
Members
449,147
Latest member
sweetkt327

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