Trying to create a custom search button in Excel - excel

I'm trying to set up a custom search for an Excel spreadsheet that I use daily. It's a new sheet that is sent to me each day, and it's huge. I need to find specific rows to gather information. What I'm trying to achieve is to create a button on my toolbar that pops up a user input box where I can enter a number, which will then be used for conditional formatting, that will look for that number in a specific column (Column C) and when it finds any instances of that number in that column it will highlight the entire row (or most of it at least), and also take me to the first instance of the number in that column.
I think a Macro is the way to go here, but my VBA coding skills are lacking.
I've managed to get the conditional formatting to work (sort of) where I can enter a number into a cell, and it will highlight 6 of the 15 columns in my spreadsheet for each row which contains that number in column C. I'm happy with that part.
I have no idea how to create the user input box though, and make the input interact with my conditional formatting. So that's where I'm stuck.
I've been searching on Google for a couple of hours, but I haven't come up with anything that works yet.
I'm not expecting anyone to create the macro for me, but some advice on how to find the information I'm after would be appreciated.

I'm using this method.. personally. Coz no macro needed.. but still do the job.
Idea : 1. enter search term in C2. 2. filter the column, that had been fed with this formula : " use search in a cell, display 1 if found. "
Implementation :
Assuming the search column/data starts at A2, do :
B2 -> =IFERROR(IF(SEARCH($C$1,A2),1,0),"")
and drag downwards.
Set up a filter in column B header. Reserve cell C1 as the "Search" box.
To use.. just enter the search term in C1, then filter/refresh filter (for 1) in column B.
Done.
Hope it helps..
p/s : Ctrl+Alt+L is the shortcut to "Reapply filter".

Related

How to add running count to excel cell, which already has text in it?

Would anyone have advise on how to add running count to excel cells, which already have text in them, and without removing the said text.
Few screenshots will follow to clarify my issue.
I have received a ton of sheets which have a test case name as a text/string in the C column and they are missing a running count from the beginning of the cell (not sure if the "running count" is the correct term).
In the first screenshot you can see how I need them to be, as well as in the couple first rows of the second screenshot (column C). So the original text could be for example "Purchase order" and I want it to be "1. Purchase order" and the next cell would be "2. Purchase order" etc.
Screenshot 1.
Screenshot 2.
I imagine there isn't an already existing function in excel which would solve my problem. I have played around with macros and VBA some years ago, but don't have any clue from on top of my head how to solve this.
Perhaps a macro that would go through each cell from the selected column one by one, cut the existing text, add a variable number to the cell and then copy the cut text back there after the variable, then add +1 to the variable before moving to the next cell?
So I somewhat understand the logic how it could be done, but don't have any memory how the syntax and the operators etc. work in VBA.
Thank you in advance.
Not exactly sure what you want from the images, but you can do things like this:
If cell A1 has 942
and cell B1 has "slices of bread"
Then C1 can have the result "942 slices of bread":
=A1&" "&B1
Not sure neither if running count is the right term, but you can do it with a helper column and an easy formula:
=COUNTIF($C$2:C2;C2)&". "&C2
Then you can copy/paste as values and delete helper column

Go down a column until a certain cell and then select a cell to the right

Trying to automate a task using VBA but am very beginner with it.
I'm trying to select column x, go down that column until it says a certain value, and then select the cell that is one to the right of the cell that contains that value. IE go down column x until it says "apple" and then select the number to the right of the cell containing "apple"
After this, I want to go to the next sheet and perform the same action. I know I need to perform some type of loop but mostly confused about how to go down a column until a certain cell and then to the right.
You want to increase the range. This thread should be helpful to you.
https://answers.microsoft.com/en-us/msoffice/forum/all/vba-select-the-ranges-next-to-the-activecell/80a080aa-6355-4700-9574-83197190164a
**FYI Need to include specific code you have tried to use to resolve and specific errors if there are any. You will get less responses if you have a 'lame' question (i.e. just hoping someone else to do it for you)

COUNTIFS ignoring rows based on values in row

I have been struggling with these two problems for the better part of the day. Please see this link to an example: https://docs.google.com/spreadsheets/d/1odU7oqc-WviLzQcghkbYbQG-4DC70-Q_hszb22Chljw/edit?usp=sharing
This is a simplified document I use to see which lecturer (name) has has added which of the 5 documents (on the right) to an online learning environment (one row for each course). The courses can be given in semester 1, 2, or in both. I want to use this document to automatically highlight a name if any of the five boxes on the right is empty if the semester I want to check (Cell D1) is similar to Column E. Furthermore, only the first time a name appears in red, should the e-mail appear so as well.
For this, I of course use conditional formatting (please see those formulas, also pasted in column M (range column C and D) and N (Range column D). N is the white conditional formatting overruling M, in which a N="TRUE" means it is whitened out).
Example 1 (Ans) shows how I intend the programme to work. The first instance shows shows both the name and e-mail in red, later instances do too unless the semester is not similar or all boxes on the right are ticked.
Example 2 (Bertrand) shows the first problem. If the first instance of a red name and e-mail occurs in a semester 'both', the second time the name should be red the e-mail does so as well. This keep occurring until a semester is similar to Cell D1, after which it is normal again.
Example 3 (Carel) shows the second problem. If the first instance in which a certain lecturer occurs all boxes on the right are ticked, the second time he occurs but does not tick all boxes his name shows in red but his e-mail doesn't.
I think problem 1 (example 2) is solved if I can get 'both' to somehow mean both 1 and 2, but I don't know how.
I think problem 2 (example 3) is solved if I can get COUNTIFS to ignore the rows is which all five boxes are ticked.
However, I have no clue how to do this. Is anyone able to help me with either (but ideally both) problems?
Thank you in advance!
I'm not entirely sure, but I think I've understood what you need.
For the first part (where a lecturer has less than all 5 subjects containing 'x' AND where E is either the value of cell D1 or the value of 'both'), try this:
Delete both of your existing conditional formatting rules.
Create a new conditional formatting rule for range = C4:C21 (or perhaps further down your sheet to row 977), with a custom formula of:
=AND(COUNTIF($G4:$K4,"x")<5,or($E4=$D$1,$E4="both"))
The style for the rule should have a red background.
For the second part (updated), this is a bit tricker with conditional formatting but I can offer a solution determined by the value of cells, like you had.
Delete the contents of cells M4:N21 (21 being where you have a formula in the furthest cell).
In cell M4, add the following formula:
=arrayformula(if(iferror(if(ifs(E4:E=$D$1,1,E4:E="both",1)+if(G4:G&H4:H&I4:I&J4:J&K4:K <>"xxxxx",1,)=2,D4:D,),)<>"",countifs(iferror(if(ifs(E4:E=$D$1,1,E4:E="both",1)+if(G4:G&H4:H&I4:I&J4:J&K4:K <>"xxxxx",1,)=2,D4:D,),),iferror(if(ifs(E4:E=$D$1,1,E4:E="both",1)+if(G4:G&H4:H&I4:I&J4:J&K4:K <>"xxxxx",1,)=2,D4:D,),),row($E4:$E),"<="&row($E4:$E))=1,))
It might seem a little complex, but it's done this way to use the functions that are compatible with ARRAYFORMULA so that it will keep working down the sheet as far as you have values in rows.
Now create a new conditional formatting rule for range = D4:D21 (or perhaps further down your sheet to row 977), with a custom formula of:
=$M4=true
The style for the rule should have a red background.

Copy data from conditional formatted cells to new tab based on the conditional formatting color in Excel

Okay so I'm new to all this- please help me if there's a better way to do this... currently trying to make changes to an existing spreadsheet and I can't figure out how to accomplish what I want...
Tab 1 accounts for different numbers and their assignments, Tab 2 rearranges that data for a printable page, and Tab 3 has a list of all the numbers we have to account for, and currently uses conditional formatting to do so. (Green if the number is accounted for on Tab 1, Red if not)
What I am trying to accomplish is create a list of all the numbers NOT accounted for (Red conditionally formatted cells on tab 3) to show up in any form on Tab 2. I started messing around with the =mycolor and IF functions, but I found that only works with explicit formatting of the cell, not the conditional formatting I am using to account for the numbers.
Do I need to change how my spreadsheet is accounting for the numbers from Tab 1 instead of conditional formatting? If so what would be the best way to go about this? If there's a way to do this with conditional formatting, how would I go about copying data based on the conditional formatting of certain cells?
Also, ideally I want this to be done without having to play a macro. I'm trying to make this as stupid simple for the end user as possible... but if there's no way to do it without recording a macro then that's what I'll end up doing.
Thanks a bunch in advance...
What I would do is add a column to tab three that is a missing/not missing column (=column C in my mock up below). Missing = 1 accounted for =0. (That can either be achieved by the same formula as used to give the red/green OR a vlookup() function). Therefore for each red row there will be a 1 alongside.
Extending that, as per my comment... index the missing values (col A=):
=IF(C3>0,SUM(C$1:C3),"")
Now use a new pair of columns to grab the missing values
And use a lookup function to line up the missing values (col G)... I only went up to 5 (col f)
=IFERROR(VLOOKUP(F3,A$3:B$6,2,FALSE),"")
THANK YOU for your help Richard!
With some changes, the Vlookup function you gave me (in Column E) worked fine:
=IF(ISERROR(VLOOKUP(E2,hiddenradios,1,FALSE)),"1","0")
And adding the second column(s) and the sum function for values was a really helpful idea: (column H)
=IF(VALUE(F2)>0,SUM(G$2:G2),"")
For whatever reason I couldn't make vlookup work, even with the column relocated to the left of the number I was trying to return, but I was able to do the same thing with an INDEX/MATCH formula in column J:
=IFERROR(INDEX(E$2:E$100,MATCH(I2,H$2:H$100,0),1),"")
Not quite as simple as yours, but you set me on the right path with adding column(s) and I wouldn't have figured it out without your help... thanks again!
enter image description here

Excel array formula that returns columns headers

The problem I am having is given an excel table:
Spreadsheet:
I am using an active X control box to select a name from column 1 (It is linked to a cell), and then I am trying to use an INDEX, SMALL, IF formula in order to search that particular row for all instances of yes and return that column header(language) into a list box.
So if I were to select John from the control box, the list box would fill with English, Spanish, and French. If I were to select Alvin the list box would fill with Spanish.
I am running into a wall here as everything I can find on the subject deals with ROW and what few COLUMN questions I do find are vague.
Assuming that the table is in A1:E8 and the active X control box is located # I1, put these in any other cell put this formula (broken down for clarity) :
=IF(LEFT(INDEX((OFFSET($B$2:$E$2,MATCH($I$1,$A$2:$A$8,0)-1,0)="Yes")&($B$1:$E$1),1),4)="TRUE",INDEX($B$1:$E$1,1)&" ","")&
IF(LEFT(INDEX((OFFSET($B$2:$E$2,MATCH($I$1,$A$2:$A$8,0)-1,0)="Yes")&($B$1:$E$1),2),4)="TRUE",INDEX($B$1:$E$1,2)&" ","")&
IF(LEFT(INDEX((OFFSET($B$2:$E$2,MATCH($I$1,$A$2:$A$8,0)-1,0)="Yes")&($B$1:$E$1),3),4)="TRUE",INDEX($B$1:$E$1,3)&" ","")&
IF(LEFT(INDEX((OFFSET($B$2:$E$2,MATCH($I$1,$A$2:$A$8,0)-1,0)="Yes")&($B$1:$E$1),4),4)="TRUE",INDEX($B$1:$E$1,4),"")
Idea : use offset to define which row to 'read' the Yes. combine the string. if true is detected, print, else blank.
please share if it works/not. (^_^)

Resources