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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
try this =SUM(--(A1*A2>0),--(B1*B2>0),--(C1*C2>0)) or check your values in source ranges (text or numbers)

1​
2​
3​
3​
=SUM(A1*A2>0,B1*B2>0,C1*C2>0)
4​
5​
6​
0​
1​
2​
1​
3​
4​
0​
 
Last edited:
Upvote 0
I tried and same result unfortunately. I have excel 2016. I tried with both General and Number formatting on the data.
 
Upvote 0
Is 13 and 17 in one cell with a space between them?

try in any cell: =ISTEXT(A1)
 
Last edited:
Upvote 0
13 -------------- 17,2 -------------- 7,6
22,23-------------- 14 -------------- 9
11,22 -------------- -------------- 14

yes. my data has blanks cells too (without 0s).
 
Last edited:
Upvote 0
=istext(a1) => true for blank cells, false for cells with numbers.
 
Last edited:
Upvote 0
it look like this?

A
B
C
D
E
F
G
H
1
13​
______
17​
2​
___
7​
6​
2
22​
23​
______
14​
___
9​
___
3
11​
22​
____________
14​
___
 
Last edited:
Upvote 0
Basically like this, but some numbers have decimals like 10,20. Sorry I don't know how to post the table like you did.
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,887
Members
449,057
Latest member
Moo4247

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