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:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I'm sorry, I don't want to give you a headache, but excel doesn't accept it, I keep getting the notification that starts with "There's a problem with this formula etc".
 
Upvote 0
sure
before I give up :) , could you post a link to shared excel file with representative example? (GoogleDrive, OneDrive or any similar)

in a meantime try this on numbers without decimals, just to check: =SUM(A1*A2>0,B1*B2>0,C1*C2>0)

with "my" decimals: (dot) not (comma)

A
B
C
D
E
1
13.23​
31.28​
44.18​
2​
=SUM(A1*A2>0,B1*B2>0,C1*C2>0)
2
22​
23​
 
Last edited:
Upvote 0
ok, try to change decimal to dot not comma like 10.5 not 10,5

all yellow are text here not a number

A
B
C
D
1
13​
17,27,6
2
22,23
14​
9​
3
11,22
14​

that is why I said about your local settings
 
Last edited:
Upvote 0
I'm sorry I can't change my data, not because I can't. but it has to be like that. I can use the if formula, I guess.
 
Upvote 0
maybe someone else will have an idea for a shorter formula than your IF () and with format of data like yours.
everything I tried so fast is the same length or longer

btw. this is not a good idea mixing data types
 
Last edited:
Upvote 0
I agree. but this task requires it. Your formula works normally, just not in my case. Thanks a lot for your time and help really.
 
Upvote 0
it can be done with longer formula but you said you want shorter than you have, so...
good luck and have a nice day :)
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,892
Members
449,058
Latest member
Guy Boot

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