A shorter alternative to IF formula

Usercode

Board Regular
Joined
Aug 18, 2017
Messages
107
Office Version
  1. 2016
Platform
  1. Windows
Is there a shorter way of doing this? please.

HTML:
=IF(AND(A1>0,A2>0),1,0)+IF(AND(B1>0,B2>0),1,0)+IF(AND(C1>0,C2>0),1,0)

Basically, if A1 and A2 are greater than 0 at the same time, it should be counted as "1", if not 0, and then all results in the range are summed.

My data are like this:

13 17,2 7,6
22,23 14 9
11,22 14



Thank you.
 
Last edited:
I wanted to decide to shorten if formula because the data is bigger than the example. but I can write it, it will be a long formula only.
 
Last edited:
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
did you try this
=SUMPRODUCT((A2:C2>0)*(A1:C1>0))

I noticed in the example c2 is blank, but =isblank(c2) is FALSE does that mean you filled this one with a formula?

see this
Compared A3 with C2 both are blank and returning different answers. Is your normal data set like this too?


Book1
ABCDEFGH
222,231491FALSETRUE
311,22140TRUEFALSE
Sheet1
Cell Formulas
RangeFormula
F2=IF(C2>0,1,0)
F3=IF(A3>0,1,0)
G2=ISBLANK(C2)
G3=ISBLANK(A3)
H2=ISTEXT(C2)
H3=ISTEXT(A3)
 
Last edited:
Upvote 0
Thanks, Twollaston. This formula works in my case. and it is a lot shorter. Thanks a lot!
 
Upvote 0
No, currently there is no formula. I think I made a mistake there.
Yes my dataset is like this. With commas, but not all numbers.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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