Dividing a cell based on another cell

danjoles1

New Member
Joined
Jan 16, 2019
Messages
4
[TABLE="width: 398"]
<tbody>[TR]
[TD]I am trying to write a formula to calculate cost per foot (cell E13)
I want the total in cell E12 to be divided by cell C8 if it has data if not move to cell C9, do this through C11.

[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Item[/TD]
[TD]Quantity[/TD]
[TD]Cost[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Corner post assembly[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]720[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]"H" assembly[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]56[/TD]
[TD="align: right"]560[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Wood line post[/TD]
[TD][/TD]
[TD="align: right"]21.88[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]T post[/TD]
[TD="align: right"]860[/TD]
[TD="align: right"]4.85[/TD]
[TD="align: right"]4171[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Fiberglass post[/TD]
[TD][/TD]
[TD="align: right"]7.28[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]3 Strand electric[/TD]
[TD][/TD]
[TD="align: right"]0.09[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]3 Strand Barbless[/TD]
[TD][/TD]
[TD="align: right"]0.16[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]4 Strand Barb[/TD]
[TD][/TD]
[TD="align: right"]0.21[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5 Strand Barb[/TD]
[TD="align: right"]14000[/TD]
[TD="align: right"]0.26[/TD]
[TD="align: right"]3640[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 3"]Total cost of material:[/TD]
[TD="align: right"]9091[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 3"]Matrerial cost per ft:[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I am trying to write a formula to calculate cost per foot (cell E13)

I want the total in cell E12 to be divided by cell C8 if it has data if not move to cell C9, do this through C11.

<tbody>
</tbody>

I am assuming you mean to say, if C8 has data?

Code:
=IFS($C$8<>"",$E$12/$C$8,$C$9<>"", $E$12/$C$9,$C$10<>"", $E$12/$C$10, $C$11<>"",$E$12/$C$11,)
 
Last edited:
Upvote 0
Well I tried that, and I removed spaces after the coma's and still receiving the name error. the code looks like this now...
=IFS($C$8<>"",$E$12/$C$8,$C$9<>"",$E$12/$C$9,$C$10<>"",$E$12/$C$10,$C$11<>"",$E$12/$C$11)
 
Upvote 0
The IFS function is not available for all excel versions, thus your error

You can convert it to nested IF functions (IF($C$8<>"",$E$12/$C$8, IF()) and so on
 
Upvote 0
The IFS function is not available for all excel versions, thus your error

You can convert it to nested IF functions (IF($C$8<>"",$E$12/$C$8, IF()) and so on

I have tried a couple different ways.

=(IF($C$8<>"",$E$12/$C$8,$C$9<>"",IF($E$12/$C$9,$C$10<>"",IF($E$12/$C$10,$C$11<>"",IF($E$12/$C$11)))))
=IF($C$8<>"",$E$12/$C$8,$C$9<>"",IF($E$12/$C$9,$C$10<>"",IF($E$12/$C$10,$C$11<>"",IF($E$12/$C$11))))
=IF($E$12/$C$8,$C$9<>"",IF($E$12/$C$9,$C$10<>"",IF($E$12/$C$10,$C$11<>"",IF($E$12/$C$11))))
=IF($C$8<>"",$E$12/$C$8,$C$9<>"",($E$12/$C$9,$C$10<>"",($E$12/$C$10,$C$11<>"",($E$12/$C$11))))
=IF($E$12/$C$8,$C$9<>"",($E$12/$C$9,$C$10<>"",($E$12/$C$10,$C$11<>"",($E$12/$C$11))))

Its not accepting these
 
Upvote 0
I don't want to give you the full formula as I don't think that will teach you how formulas work, and I don't think you're showing incentive to learn how they do..

When you type =IF() in the formula bar (or any other valid formula for that instance), you'll be able to open the Function Arguments window by clicking on the fx symbol left of the formula bar. Here you will be able to see and fill in all arguments for the formula.

For the IF() function, there are three arguments:
1. the logical test
2. the value if the logical test is true
3. the value if the logical test is false

So, IF(1=1, "a", "b") will return "a" because 1 is always equal to 1.

In your case you want to test whether cell C8 has a value. If it does, you want to divide E12 by that number. If it does not, you want to redo the IF() function for cell C9 (see the three arguments of the IF() function?). So, you end up with a nested IF() function.
 
Upvote 0
[TABLE="width: 398"]
<tbody>[TR]
[TD]I am trying to write a formula to calculate cost per foot (cell E13)
I want the total in cell E12 to be divided by cell C8 if it has data if not move to cell C9, do this through C11.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Hi, if only one cell in C8 to C11 can ever be populated then you could simply use something like.


Excel 2013/2016
BCDE
2ItemQuantityCostTotal
3Corner post assembly890720
4H assembly1056560
5Wood line post21.880
6T post8604.854171
7Fiberglass post7.280
83 Strand electric0.090
93 Strand Barbless0.160
104 Strand Barb0.210
115 Strand Barb140000.263640
12Total cost of material:9091
13Matrerial cost per ft:0.649357
Sheet1
Cell Formulas
RangeFormula
E13=E12/SUM(C8:C11)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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