# Need Formula Help

#### ThursRed

##### New Member
This might not be entirely possible, but I've been trying to figure it out for a week and now I have a headache. Anywho, I'm trying to figure out what's wrong with this formula. I know it's riddled with problems:

=if(j8+j9=0 and l2>m2, then replace (p2 "1" and q2 "0"), replace (p2 "j9" and q2 "j8"))

The j9 and j8 cells are actual cells, I want the content of the cells, a number that changes a lot. The numbers in the quotation marks are the ones I want replacing. I know nothing about all this formula stuff so that code is a total guess. Any help would be appreciated.

### Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
We need a few points clarified...

1. When you say "replace(p2 '1' and q2 '0')", you mean put the number 1 in cell P2 and put the number 0 in cell Q2, correct?

2. What should happen if J8+J9=0 BUT L2<=M2?

3. What should happen if L2>M2 BUT J8+J9<>0?

Thanks for the quick reply. Sorry for not being clear, I'm not great at this. I'll try and clarify:

1. Yes, I'd like the number 1 in Cell P2 and the number 0 in Cell Q2, if possible.

2. If this happened, I'd like the formula to be reversed, so P2 = 0, Q2 = 1, then P2 replaced with Cell J9 and Q2 replaced with Cell J8, like in the original formula.

3. I'll try and explain the formula a bit better. Cell J8 and Cell J9 are the result of another, very complicated formula, that can give 0,0 results. I've added Cell J8 to Cell J9 because if both numbers are zero, it would equal zero. I need Excel to work out if Cell J8 added Cell J9 is zero, and, if so, then work out which number is highest between Cell L2 and Cell M2. If Cell L2 is higher than Cell M2, I would like a 1 in Cell P2 and a 0 in Cell Q2, or if Cell M2 is higher than Cell L2, a 0 in Cell P2 and a 1 in Cell Q2. If both numbers aren't 0,0 I need the formula to recognize that and leave them alone. The formula I gave was my best attempt to do all this, but I admit, it's not right.
I hope all that made sense.

I may have figured this out, except I keep getting a 'missing parenthesis' result and I'm not entirely sure what it's talking about. Here's the revised formula:

=if(and(k9="0", l2>m2), replace (and(p2, "1", q2, "0"), replace (and(p2, j8, q2, j9))

Replies
6
Views
231
Replies
1
Views
172
Replies
0
Views
138
Replies
7
Views
66
Replies
2
Views
252

1,203,182
Messages
6,053,972
Members
444,695
Latest member
asiaciara

### 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.

### Which adblocker are you using?

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

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