Problem with formula: Replace with code

Aretradeser

Board Regular
Joined
Jan 16, 2013
Messages
176
Office Version
  1. 2013
Platform
  1. Windows
I have some data in an Excel sheet (sheet1), in column 2, name records; and, from column 3 to 14, the months of the year with number records.
On sheet2, from column 10 to 21, in row 4, the following formula:
Excel Formula:
INDICE(Sheet1!$B$3:$N$25;COINCIDIR(0;Sheet1!$C$3:$C$25;0);1)
which detects which name has a zero and records it where that match exists.
The problem occurs when there is more than one name with zero records, it only records the first one it finds, not the rest.
Example:
On sheet2, column10, row3, in January, it only records name10, when names12 and 13, 17, 18, 20 and 22 also meet this criterion. If I drag the formula down, it still records name10. and so it happens with all months.
Could this be solved with lines of code that would register all the names that meet this condition (zero registration)?
Thanks
Libro1
BCDEFGHIJKLMN
2NAMESJANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
3Name12303571023010
4Name22210614012300910
5Name32456040106240
6Name421411148713060
7Name52273611401414114
8Name6135731400111404
9Name72278101211205138
10Name8233040146000
11Name9240013119910395
12Name10043101001318993
13Name11205068008534
14Name12023131081367100
15Name13019714121006704
16Name141049013050024
17Name151097130012101303
18Name1623891161001000
19Name170901912111471200
20Name18059471043114913
21Name19100547700001
22Name2006121130321135
23Name21621706601008
24Name220678100010037
25Name2328135341070100
Hoja1

Libro1
JKLMNOPQRSTU
3JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
4Name10Name11Name1Name8Name3Name2Name3Name1Name2Name2Name1Name3
5Name10
6Name10
7Name10
8
Hoja2
Cell Formulas
RangeFormula
K4:U4K4=INDEX(Hoja1!$B$3:$N$25,MATCH(0,Hoja1!D3:D25,0),1)
J4:J7J4=INDEX(Hoja1!$B$3:$N$25,MATCH(0,Hoja1!$C$3:$C$25,0),1)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
The problem occurs when there is more than one name with zero records, it only records the first one it finds, not the rest.
Because that is how the MATCH function works, it tells you this in the help file. You don't need code for such a simple task, just the correct formula. Note that this is done on the same sheet as the source table so you will need to add sheet names if you're using 2 sheets.
Cell Formulas
RangeFormula
P3:AA12P3=IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($B$3:$B$25)/(C$3:C$25=0),ROWS(P$3:P3))),"")
 
Upvote 0
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Cell Formulas
RangeFormula
J4:U13J4=IFERROR(INDEX(Sheet1!$B$3:$B$25,AGGREGATE(15,6,(ROW(Sheet1!$B$3:$B$25)-ROW(Sheet1!$B$3)+1)/(Sheet1!C$3:C$25=0),ROWS(J$4:J4))),"")
 
Upvote 0
Solution
jasonb 75 and Fluff, thank you for your quick and accurate responses. The formulas work perfectly. However, I see a small practical problem with them.
Currently, I have about 1200 records and, with the application of formulas, I have to drag them until I reach the last row of the column in which there are no more records that meet this condition. I could do the same with code and when I execute it with a button, it would do the same and, in addition, it would register the new names that meet this requirement.
In any case, I thank you for having put your time and knowledge into this project.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,730
Messages
6,126,527
Members
449,316
Latest member
sravya

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