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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
try this =SUM(--(A1*A2>0),--(B1*B2>0),--(C1*C2>0)) or check your values in source ranges (text or numbers)

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td]
1​
[/td][td]
2​
[/td][td]
3​
[/td][td=bgcolor:#FFFF00]
3​
[/td][td]=SUM(A1*A2>0,B1*B2>0,C1*C2>0)[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
4​
[/td][td]
5​
[/td][td]
6​
[/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
0​
[/td][td]
1​
[/td][td]
2​
[/td][td=bgcolor:#FFFF00]
1​
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
3​
[/td][td]
4​
[/td][td]
0​
[/td][td][/td][td][/td][/tr]
[/table]
 
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?

[Table="width:, class:head"][tr=bgcolor:#000000][th] [/th][th]
A
[/th][th]
B
[/th][th]
C
[/th][th]
D
[/th][th]
E
[/th][th]
F
[/th][th]
G
[/th][th]
H
[/th][/tr]
[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
1
[/td][td]
13​
[/td][td]___[/td][td]___[/td][td]
17​
[/td][td]
2​
[/td][td]___[/td][td]
7​
[/td][td]
6​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
2
[/td][td]
22​
[/td][td]
23​
[/td][td]___[/td][td]___[/td][td]
14​
[/td][td]___[/td][td]
9​
[/td][td]___[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#000000]
3
[/td][td]
11​
[/td][td]
22​
[/td][td]___[/td][td]___[/td][td]___[/td][td]___[/td][td]
14​
[/td][td]___[/td][/tr]
[/table]
 
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,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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