If statement

ekhawaja

Board Regular
Joined
Dec 16, 2018
Messages
60
Office Version
  1. 365
Looking for an if statement to check 5 column for value of "1", and if ALL have 1, return "1", otherwise "0"

1708540584706.png
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Something like this:

Excel Formula:
=IF(COUNTIF(A2:E2,1)=5,1,0)
 
Upvote 0
Thank you so much for the reply - SORRY i should have been more clear, what about this scenario, where the values are not in the adjacent columns. Formula to be in col K.
1708541121309.png
 
Upvote 0
Are there any values in between the columns which can contain a 1?
 
Upvote 0
As well as the question by dreid1011, will you only have 1s & 0s in those columns, or could you have other numbers?
 
Upvote 0
A couple of options for you then, in Columns L and M which specifically look at every other column from A to I.
Book1
ABCDEFGHIJKLM
1IFFLOORMAX/SUMIF/SUM
21213141511111
31110001110100
410110000
Sheet4
Cell Formulas
RangeFormula
J2:J4J2=IF(COUNTIF(A2:I2,1)=5,1,0)
K2:K4K2=FLOOR.MATH(COUNTIF(A2:I2,1)*0.2,1)
L2:L4L2=MAX(SUM(INDEX(A2:I2,,SEQUENCE(1,5,1,2)))-4,0)
M2:M4M2=IF(SUM(INDEX(A2:I2,,SEQUENCE(1,5,1,2)))=5,1,0)


I suppose I should have waited for your answer to Fluff's question whether the cells you want to count contain other values than 1 or 0... it may change the solution offered.
 
Last edited:
Upvote 0
A couple of options for you then, in Columns L and M which specifically look at every other column from A to I.
Book1
ABCDEFGHIJKLM
1IFFLOORMAX/SUMIF/SUM
21213141511111
31110001110100
410110000
Sheet4
Cell Formulas
RangeFormula
J2:J4J2=IF(COUNTIF(A2:I2,1)=5,1,0)
K2:K4K2=FLOOR.MATH(COUNTIF(A2:I2,1)*0.2,1)
L2:L4L2=MAX(SUM(INDEX(A2:I2,,SEQUENCE(1,5,1,2)))-4,0)
M2:M4M2=IF(SUM(INDEX(A2:I2,,SEQUENCE(1,5,1,2)))=5,1,0)


I suppose I should have waited for your answer to Fluff's question whether the cells you want to count contain other values than 1 or 0... it may change the solution offered.
i will only have 1 or 0.
 
Upvote 0

Forum statistics

Threads
1,215,355
Messages
6,124,468
Members
449,163
Latest member
kshealy

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