?
Solved

EXCEL: cleaning up a list using search

Posted on 2012-12-27
5
Medium Priority
?
259 Views
Last Modified: 2013-01-10
I keep getting errors after the search function is added.  Please see attached file.  I am looking to get a clean list of active project numbers and descriptions starting in cell F5.

I have an INACTIVE column that, once filled, formats the text to the left as strikethrough.

The bottom of the list is at ROW 1001

Here is my desire:
Pull a list of project numbers and names that have NOTHING in the INACTIVE column (column D).  In other words, I would like a clean list of only ACTIVE projects.
TIA
ProjectList.xlsx
0
Comment
Question by:gpchicago08
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Expert Comment

by:critter017
ID: 38724888
VBA code would be be simply:

Y = 5
For X = 5 To 1001
   If Range("D" & X) = "" Then
      Range("F" & Y).Value = Range("A" & X).Value
      Range("G" & Y).Value = Range("B" & X).Value
      Y = Y + 1
   End If
Next

I have attached a macro enabled Excel file containing the macro which has been run for you.
ProjectList.xlsm
0
 

Author Comment

by:gpchicago08
ID: 38725048
Close but not really what I was intending.  I don't want a macro to run.  I have a formula here that does the OPPOSITE of what I need.  It gives me all of the INACTIVE projects.  Can you help me invert the SEARCH function so that I can get sort to all empty cells?

Plop this into F5 of my original file and hit ctrl-shft-enter and then drag it down a few cells to see how it works.  It automatically updates the list based on whether something is in the cell.



=INDEX($A$5:$A$1001,MATCH(SMALL(IFERROR(SEARCH(,$D$5:$D$1001),2^32)+ROW($D$5:$D$1001)/1000,ROWS($F$5:F5)),IFERROR(SEARCH(,$D$5:$D$1001),2^32)+ROW($D$5:$D$1001)/1000,0))

Open in new window

0
 

Accepted Solution

by:
gpchicago08 earned 0 total points
ID: 38725095
Since I got this to work backwards, I just changed my concept and put a value in for all ACTIVE projects and now it works!
0
 
LVL 2

Expert Comment

by:hanklm
ID: 38726123
That's quite a formula!  At first glance I'm not even sure how it works.

I played around with a couple simpler formulas that aren't as clever and take an extra column, but maybe when you revisit this spreadsheet in a month or two you might come to appreciate them.  

First, I built on your idea to swap the sense of the Inactive Column to mean Active when it has an X.  (You could easily add a column that did that swap for you and then base results on it.)

First, in E4 I put a 0
Then in E5, F5, and G5 I put:
=IFERROR(MATCH("x",OFFSET(active,E4,0),0)+E4,"")
=IF(E5<>"",INDEX(PROJECTSACCTG,E5,1),"")
=IF(E5<>"",INDEX(PROJECTSACCTG,E5,2),"")

where active is a named range for what started as the INACTIVE column. Then copy these formulas down.

The workhorse here is the combination of match and offset.  Offset uses the previously found row (thus the 0 in E4) as a starting row for the match operation.  I think this might prove faster should your number of projects ever grow quite large.
0
 

Author Closing Comment

by:gpchicago08
ID: 38762294
I used my original code and changed my logic
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question