If field is blank divide by a different cell

BigD1980

New Member
Joined
Mar 21, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi all, new poster here. Please be gentle with me. :)

I will regularly be producing tables as per the below. The data is a product code, batch number, batch volume, whether the product pH was adjusted using NaOH or HCl and the amount (ml) added per batch. I then need it to calculate how much was added per Litre of either NaOH or HCl. For example this would be D2/C2 in row 2, however in row 3 it would need to be E4/C4. I have tried playing aroud with IF and IFERROR. It seems like it should be a really simple formula, but I have been unsuccessful so far.

1711020841915.png


Apologies in advance for my lack of knowledge and thanks in advance for any help.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
The data you've supplied implies there will ALWAYS be a value in D or E.
Based on that

=MAX(D2:E2)/C2

should work
 
Upvote 1
Hi all, new poster here. Please be gentle with me. :)

I will regularly be producing tables as per the below. The data is a product code, batch number, batch volume, whether the product pH was adjusted using NaOH or HCl and the amount (ml) added per batch. I then need it to calculate how much was added per Litre of either NaOH or HCl. For example this would be D2/C2 in row 2, however in row 3 it would need to be E4/C4. I have tried playing aroud with IF and IFERROR. It seems like it should be a really simple formula, but I have been unsuccessful so far.

View attachment 108772

Apologies in advance for my lack of knowledge and thanks in advance for any help.
Correction - row 3 would be E4/C4
 
Upvote 0
there are many ways to resolve this. Here is one of them;Formula in F2 (and down):
Excel Formula:
=SUM(D2:E2)/C2
 
Upvote 1
Solution
Perfect! Thank you so much, I was attacking it fromthe wrong end.
Not necessarily, here is an if solution:
Excel Formula:
=IF(ISBLANK(D2),E2,D2)/C2
or you can wrap it in IFERROR to avoid errors when C2 is empty:
Excel Formula:
=IFERROR(IF(ISBLANK(D2),E2,D2)/C2,"")
 
Upvote 0
I should have made it clear that occasionally there will be no data in column D or E. Using the =SUM(D2:E2)/C2 formula therefore works better. Thank you both for such a quick response, it is very much appreciated. Have a good day.

 
Upvote 0
Not necessarily, here is an if solution:
Excel Formula:
=IF(ISBLANK(D2),E2,D2)/C2
or you can wrap it in IFERROR to avoid errors when C2 is empty:
Excel Formula:
=IFERROR(IF(ISBLANK(D2),E2,D2)/C2,"")
Wow! There really is more than one way to skin a cat, as long as you are clever enough!
 
Upvote 0

Forum statistics

Threads
1,215,134
Messages
6,123,237
Members
449,093
Latest member
Vincent Khandagale

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