Greater or less than in cell to use in formula

Numbers123987

New Member
Joined
May 26, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi, I am for a few days stuck in looking for a solution to fill in the greater than or less than symbols(>, <) in a cell so that it is easily adjust the result of a sumproduct formula.
=sumproduct(--(choose(B3;C5:C25>0;C5:25<0));--(D5:D25>25%);--(E5:E25))
B3 = 2 (1 stands for greater than, 2 stands for less than)

Above formula is resulting in #Value!

Is it possible to use a cell for < and > (or 1 and 2) so that it is adding it to a sumproduct formula in combination with choose?
If yes, what am I doing wrong?

Any help as very much appreciated!
 

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.
Welcome to the forum!

How about:

=SUMPRODUCT(--(C5:C25>0),--(D5:D25>25%),E5:E25)*(B3=1)+SUMPRODUCT(--(C5:C25<0),--(D5:D25>25%),E5:E25)*(B3=2)
 
Upvote 0
Welcome to the forum!

How about:

=SUMPRODUCT(--(C5:C25>0),--(D5:D25>25%),E5:E25)*(B3=1)+SUMPRODUCT(--(C5:C25<0),--(D5:D25>25%),E5:E25)*(B3=2)
Magic! Thank you very much indeed!
Should have joined earlier ;)

Cheers,
Eric H
 
Upvote 0
=SUMIFS(E5:E25, C5:C25, CHOOSE(B3, ">0", "<0"), D5:D25>25%)

or

=IFERROR(SUMIFS(E5:E25, C5:C25, CHOOSE(B3, ">0", "<0"), D5:D25>25%), 0)

The latter covers instances when B3 is neither 1 nor 2, if that's possible.
 
Upvote 0
Thanks joeu and Eric,

For the sumifs it works when using CHOOSE(B3, ">0", "<0"). However the reason why I started using sumproduct was that the zero's are sometimes also other numbers and therefore also referring to cells. I tried SUMIFS(E5:E25, C5:C25, CHOOSE(B3, ">", "<")&D3, D5:D25,">25%") but that was without success.
D3 was the swap for 0.
 
Upvote 0
What is wrong with your formula.. It is working i suppose with Choose function.

Book1
ABCDE
1118%1
2-120%2
3230%3
4Criteria
520
6
Sheet1
Cell Formulas
RangeFormula
B5B5=SUMPRODUCT(--CHOOSE(A5,C1:C3>0,C1:C3<0),--(D1:D3>25%),--(E1:E3))


Help me if i made a mistake.
 
Upvote 0
No you didn't make a mistake. With sumproduct solution of Eric it is working fine.
However I was questioning if the formula was also possiible with sumifs and in particular with cell reference instead of <0?
like: SUMIFS(E5:E25, C5:C25, CHOOSE(B3, ">", "<")&D3, D5:D25,">25%")
D3 is in the example changing the 0.
 
Upvote 0
No you didn't make a mistake. With sumproduct solution of Eric it is working fine.
However I was questioning if the formula was also possiible with sumifs and in particular with cell reference instead of <0?
like: SUMIFS(E5:E25, C5:C25, CHOOSE(B3, ">", "<")&D3, D5:D25,">25%")
D3 is in the example changing the 0.


Your Question for Post 1.
The formula is working with Sumproduct & Choose as solution provided by Mr ERIC

also from Post 8, sumifs will work using choose function with constraint changing in cell D3. It is working in my case perfectly
 
Upvote 0
Thanks CA Punit! yes you are right. With sumifs it works as well (I had a typo in my previous formula that I did not see).
Thanks all for the help, very much appreciated!
 
Upvote 0

Forum statistics

Threads
1,215,597
Messages
6,125,738
Members
449,255
Latest member
whatdoido

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