formula required to get value of a range

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
In A2 I need a formula to get value of range C2:L2 for which C3:L3 is ZERO "0"
At a time there will be only 1 0 in C3:L3

Thanks in advance for the help.

Sheet1

ABCDEFGHIJKL

<colgroup><col style="FONT-WEIGHT: bold; WIDTH: 30px"><col style="WIDTH: 64px"><col style="WIDTH: 64px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"><col style="WIDTH: 40px"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]7[/TD]

[TD="align: right"]200[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]51[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]400[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]

</tbody>
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Just now I checked...
C3 & D3 is 0
But answer is D2 (Wrong). I want the formula should give C2 (in this case).
 
Upvote 0
Just now I checked...
C3 & D3 is 0
But answer is D2 (Wrong). I want the formula should give C2 (in this case).

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][td]
C​
[/td][td]
D​
[/td][td]
E​
[/td][td]
F​
[/td][td]
G​
[/td][td]
H​
[/td][td]
I​
[/td][td]
J​
[/td][td]
K​
[/td][td]
L​
[/td][/tr][tr][td]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
2​
[/td][td]
10
[/td][td][/td][td]
10
[/td][td]
20
[/td][td]
5
[/td][td]
4
[/td][td]
8
[/td][td]
7
[/td][td]
2
[/td][td]
11
[/td][td]
100
[/td][td]
50
[/td][/tr]
[tr][td]
3​
[/td][td][/td][td][/td][td]
0
[/td][td]
0
[/td][td]
[/td][td]
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
4​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


A2 houses the formula:

=LOOKUP(BigNum,1/ISERROR(1/C3:INDEX(C3:L3,MATCH(BigNum,C3:L3)-1)),C2:INDEX(C2:L2,MATCH(BigNum,C3:L3)-1))
 
Upvote 0
No it doesn't works.
Mistake 1: C3=0 & rest D3:L3=1, formula gives C2 (formula should give "")
Mistake 2: C3=0, D3=0 & rest E3:L3=1, formula gives D2 (formula should give C2)

It works only when:
All C3:L3=0; Formula gives K2 (Correct)
 
Upvote 0
No it doesn't works.
Mistake 1: C3=0 & rest D3:L3=1, formula gives C2 (formula should give "")
Mistake 2: C3=0, D3=0 & rest E3:L3=1, formula gives D2 (formula should give C2)

It works only when:
All C3:L3=0; Formula gives K2 (Correct)

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][td]
C​
[/td][td]
D​
[/td][td]
E​
[/td][td]
F​
[/td][td]
G​
[/td][td]
H​
[/td][td]
I​
[/td][td]
J​
[/td][td]
K​
[/td][td]
L​
[/td][/tr][tr][td]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
2​
[/td][td]2nd 0 result[/td][td][/td][td]
10​
[/td][td]
20​
[/td][td]
5​
[/td][td]
4​
[/td][td]
8​
[/td][td]
7​
[/td][td]
2​
[/td][td]
11​
[/td][td]
100​
[/td][td]
50​
[/td][/tr]
[tr][td]
3​
[/td][td][/td][td][/td][td]
0​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][/tr]
[tr][td]
4​
[/td][td]
10​
[/td][td][/td][td]
0​
[/td][td]
0​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][/tr]
[tr][td]
5​
[/td][td]
100​
[/td][td][/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][td]
0​
[/td][/tr]
[tr][td]
6​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
7​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


In A3 control+shift+enter, not just enter, and copy down...

Either:

=IF(SUM(ISERROR(1/C3:L3)+0)>1,INDEX($C$2:$L$2,LARGE(IF(C3:L3=0,COLUMN(C3:L3)-COLUMN(C3)+1),2)),"")

Or:

=IF(SUM(ISERROR(1/C3:L3)+0)>1,LOOKUP(BigNum,C3:INDEX(C3:L3,MATCH(BigNum,1/ISERROR(1/C3:L3))-1),$C$2:$L$2),"")
 
Upvote 0
=IF(SUM(ISERROR(1/C3:L3)+0)>1,INDEX($C$2:$L$2,LARGE(IF(C3:L3=0,COLUMN(C3:L3)-COLUMN(C3)+1),2)),"")

This formula WORKS & quiet satisfactorily. Thanks Aladin for the help.
I have not checked 2nd formula. My target is 'faster' formula since my worksheet is on RTD basis & lot of formulas are there. Can you suggest which of your 2 formulas will be more 'faster'?
 
Upvote 0
=IF(SUM(ISERROR(1/C3:L3)+0)>1,INDEX($C$2:$L$2,LARGE(IF(C3:L3=0,COLUMN(C3:L3)-COLUMN(C3)+1),2)),"")

This formula WORKS & quiet satisfactorily. Thanks Aladin for the help.
I have not checked 2nd formula. My target is 'faster' formula since my worksheet is on RTD basis & lot of formulas are there. Can you suggest which of your 2 formulas will be more 'faster'?

I think the LARGE formula is fast enough and it certainly shows the "right" behavior.
 
Upvote 0
Formula required for A3:

To consider LAST occurrence of 0 in C3:L3 & get value from CORRESPONDING C4:L4
IF ONLY C3=0 & rest all D3:L3=1, then A3 should be ”” (null)

How to accomplish?
Sheet1

ABCDEFGHIJKL

<colgroup><col style="FONT-WEIGHT: bold; WIDTH: 30px"><col style="WIDTH: 64px"><col style="WIDTH: 64px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"><col style="WIDTH: 33px"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]50[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]84[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="align: right"]22[/TD]
[TD="align: right"]28[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]84[/TD]
[TD="align: right"]44[/TD]
[TD="align: right"]55[/TD]
[TD="align: right"]66[/TD]
[TD="align: right"]42[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]1[/TD]

</tbody>
 
Upvote 0

Forum statistics

Threads
1,222,690
Messages
6,167,666
Members
452,130
Latest member
IRSHAD07

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