Find and Replace based on set criteria/table - Excel - excel

I have an expense file with a Description column that I want to categorize into a new "Category" column. For example, anything in the Description column that contains "Meijer" would categorize as "Groceries", anything in the Description column that contains "Comed" would categorize as "Utilities", etc.
Is there a way to connect my "Key" table into the Category column without a lengthy formula?
enter image description here
I tried the equation: IF(ISNUMBER(SEARCH("meijer",A1)),"Utilities",IF(ISNUMBER(SEARCH("comed",A1)),"Bills & Utilities")) however that got lengthy and very manual.
I've also tried searching for a "find and replace if a condition is met" equation, but have had no luck. (And if possible, I'd like to avoid using power query)

If your text is entered starting with cell A1, then in cell B2 and below you put this formula:
=INDEX(FILTER($E$3:$E$6,ISNUMBER(SEARCH($D$3:$D$6,$A2))),1)
It would look better and be easier to maintain if you convert both ranges to tables.
To help others respond faster, it would help if you put the data in an Excel file somewhere in the cloud. That would have saved me time in typing your data.

Related

Trying to create a custom search button in 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".

Excel SUMIFS checking if a column contains text

I have an excel document with data in a PivotTable that is displayed with several subcategories. I need to check if text anywhere in column A contains a particular word and then also check the text in column C to see if it contains a particular exact phrase.
So far, I'd come up with
=SUMIFS('tab1'!D5:D300, 'tab1'!A5:A300, "WORD", 'tab1'!C5:C300, "PHRASE")
The issue I've run into is that the excel tab this formula is checking displays information like this and it will give me the result of "0" for anything but the first phrase (which I assume is because the first phrase shares a row with the category "WORD"):
Excel Information Example:
The data in the PivotTable can change drastically throughout the year, and it is how it displays the information so I have no control over how that information is presented.
Is there a way to check if column A at any point contains a particular word, but doesn't necessarily need to match up in the appropriate row.
=IF(INDEX(C5:C300,MATCH("WORD 2",A5:A300,0),0)<>"PHRASE","",INDEX(D5:D300,MATCH("WORD 2",A5:A300,0)))
Hope it'll help.. (:

Add cell values having particular text

First, I know that DSUM and SUMIF works with the values in the entire cell. I would like to know if I can add values of cells where part of the string contains a particular text.
Let me explain. I use Google Sheets to manage my expenses, and gather data about my financials. I have something like this—
As you can see, above is a typical example of a day. Each cell has a category, and a description, and below it, the value in the next row. Now is it possible to add values of the cell containing the word "TAXIS"? This way I should be able to get a sum of expenses for a particular category.
I've tried a vast number of expense managers, but none that I am happy with. Finally have decided to go the manual route, and here I am. Any help would be appreciated. Thanks in advance!
You can use wild card to add part of string. Suppose you data starts from C2 cell and data goes like your screenshot then you can use following formula.
=SUMIF(C2:K2,"*TAXIS*",C3:K3)
Obviously you have to customize formula based on your sheet from where data starts and ends.

how can I find total excluding certain row

Apology if this question has been answered before. In the Summary column I would like to calculate total values for each UserID, excluding Fee which is always 19. As you see there are duplicate UserID's.
I was thinking of using SUMIF'S something like...
=SUMIF(Value, Name,<>"Fee,<>
then I couldn't get it right.
So for example UserID 4836344 total value would be 97.83.
What formula should be used to solve this problem.
Thanks in advance if anyone can help me.
P.S - Let me know if you cannot see the image below.
I would just add another column EffectiveValue that would contain effective value that needs to be added to the total sum. Formula for that column would be something like '=If([Name]="Fee";0;[Value])'.
Then I would sort table by UserId column.
After that I would use Data -> Subtotals feature to produce total sum per user. In wizard you would specify that on every change in UserId calculate sum of EffectiveValue
Sorry if there are syntax mistakes & formatting, but I am writing from mobile phone.
You got your SUMIFS formula almost right. You just need to include the <> within the quotation marks like so:
=SUMIFS($E$2:$E$19,$A$2:$A$19,A2,$D$2:$D$19,"<>Fee")
The above assumes that your sample table starts at A1 with UserID and continues through column E with the values. The above formula would go into cell F2 as the first summary and should be copied down. Keep in mind to adjust the range to include more rows (here only through row 19).
If you have the above sample as a table then you can also use the following formula for F2 and Excel will automatically copy it down:
=SUMIFS([value],[userid],A2,[name],"<>Fee")
To convert your table to an "Excel recognized table" select the entire table and press Ctrl + T as described in more detail on Microsoft's website.
For more information on "Tables in Excel" you might want to read the following articles:
Overview of Excel tables
Use Excel tables to manage information

Group rows and sum the last column

My original data looks like this:
I want my data to be transformed into:
Is there any way that we can do this without using pivot/subtotals. The reason why I am against pivot/subtotals is because i want to merge this data with some other data and do some calculations. VBA holds good too.
Any ideas please? I do not want the entire solution here, just suggest me some idea to proceed. I did a bit of research and all those were just the pointers to Pivot/Subtotals.
What have you tried? Please share your code/research.
For the "Total Effort" try:
=SUM(IF(B$2:B$9=G2;D$2:D$9))
And hit CTRL+SHIFT+ENTER when editing the cell value. Then drag it down.
Where "G2" is the "Name" value. "B2:B9" is the "Name" column and "D2:D9" is the "Total Effort" column.
Other columns:
To get the other columns you need to get the unique values. Try this for the ID column (assuming you want the unique IDs in Column F):
=INDEX($A$2:$A$9;MATCH(0;INDEX(COUNTIF($F$1:F1;$A$2:$A$9);0;0);0))
And hit CTRL+SHIFT+ENTER when editing the cell value. Then drag it down until you get #N/A values.
Where "A2:A9" is the "ID" column. "F1:F1" is the new column with the unique "ID".
I do this all the time for sundy data munging, you can connect to the workbook using ADO and run a SQL groupby statement on the sheet.
If you don't want to use VBA then you can do the same thing with microsoft query, though its a bit clunky using Data> from other sources > From microsoft query (data source = excel file).
For an easier query builder you could just import your table into Access and run a groupby query there, then copy paste it back.

Resources