I would like to create a CommandButton macro in excel to determine if the name is the same with the one I'm searching for and if it is the same I will be getting the value of the cell beside it and add it all together to get the final amount.
This will be the example that I would like to do:
this will be the flow:
I will first check if the cell value is the same with the name
If it is James I will get the amount and add it to the total value for James, same goes for Ramirez
After everything is checked the accumulated value will then be placed on the cell beside James/Ramirez's name
Is there a way to do this in Excel? or any faster way to do this without using a commandbutton?
You don't need to use marco for this.
You can simply type in a function
In the example shown below,
E2:=SUMIF(A2:A6,D2,B2:B6)
E3:=SUMIF(A2:A6,D3,B2:B6)
EXPLANATION
=SUMIF(range_where_the_keyword_will_be,term_to_search,corresponding_values)
If you type "Ramirez" in D2, E2 will give you "300".
TIPS
If you want it to give you a message (such as, "not existing"), when you type in a name that is not in the list, you can try the function below.
=IF(COUNTIF(A2:A6,D2)<>0,SUMIF(A2:A6,D2,B2:B6),"Not existing")
Related
I'm making a spreadsheet to try and help track peoples heart of azeroth levels, and I've got my cell set as
=IMPORTXML("https://worldofwarcraft.com/en-gb/character/Zenedar/Father","//*[#class='GameIcon-level']")
however it seems to return the number 36 twice, once in the cell I want and another in the cell below, how do I refine this to a single cell of '36'
How about these modifications? In this modification, it adds the parent node.
Modified formula 1:
When you want to retrieve 1st value of 2 values, you can use this.
=IMPORTXML(A1,"//div[#class='CharacterProfile-item']//*[#class='GameIcon-level']")
Modified formula 2:
When you want to retrieve 2nd value of 2 values, you can use this.
=IMPORTXML(A1,"//div[#class='List-item']//*[#class='GameIcon-level']")
Note:
You can also use div[#class='GameIcon-level'] instead of *[#class='GameIcon-level'].
Having issues with merging some IFs and VLOOKUPs most probably.
Basically, workflow would look like below and I don't quite know how to type it into one formula.
Look for value from Values to look for in the table on the right hand side.
If found in the list text string, return the corresponding value from add/remove column to B column.
Excel screenshot sample
The answer will only work if you make the name for the values unique. What I mean by this is, that you will need to change the name of value1 to value01 if you have more than 10 values. If you have more than 100 values, than you will need to change the name to value001 and so on.
Then use this in B2 and drag down as needed:
{=INDEX($D$3:$D$6,MATCH(TRUE,FIND(A2,$E$3:$E$6)>0,0))}
NOTE: you dont have to entere the brackets {}. These just indicate that this is an array-formula. This needs to be entered with CTRL + SHIFT + ENTER instead of the normal ENTER.
try this formula: =IF(IFERROR(SEARCH(A2,E2),"Not Found")="Not Found","Not Found",D2)
also please see the screenshot attached Example
I am looking to get some help with a function that I am sure is an option but I sadly have no clue on how to implement.
Basically, I'd like a formula to go from C21:C50 and look for the top two values. Based upon which two are the top, it would reference the name in B column and populate that value in the another cell (the cell the formula resides in)
If you look at the image, in the primary field, we'd have Steve. Secondary would be Alan.
Is this something anyone can help with? I simply am lost :(
Try
=INDEX($B$3:$B$7,MATCH(LARGE($C$3:$C$7,ROW(A1)),$C$3:$C$7,0))
with Bob in cell B3 and the "primary" formula in cell C9. Copy down to cell C10.
If dealing with integers, you can simply add +1/ROW([range]) to avoid doubles:
=INDEX($B$3:$B$7,MATCH(LARGE($C$3:$C$7+1/ROW($C$3:$C$7),ROW(A1)),$C$3:$C$7+1/ROW($C$3:$C$7),0))
This is an array-formula and must be confirmed with ctrl+shift+enter!
However, this may fail for numbers like 5.01 or 4.99. For that case just use it in combination with RANK.EQ:
=INDEX($B$3:$B$7,MATCH(LARGE(RANK.EQ($C$3:$C$7,$C$3:$C$7,1)+1/ROW($C$3:$C$7),ROW(A1)),RANK.EQ($C$3:$C$7,$C$3:$C$7,1)+1/ROW($C$3:$C$7),0))
This is an array-formula and must be confirmed with ctrl+shift+enter!
The steps as picture:
The first table shows the direct adding of 1/ROW which is used for LARGE and MATCH to get the row if doubles exist (so INDEX can pick the correct one)
The second table shows how the values get replaced by their rank with RANK.EQ and then are treated the same like the first table.
The third (grey) table shows, what would happen if the first formula is applied to the second table (to demonstrate how the ranks get messed up).
For Excel 2007 just replace the RANK.EQ($C$3:$C$7,$C$3:$C$7,1) with RANK($C$3:$C$7,$C$3:$C$7,1).
If you still have any questions, just ask :)
I'm having trouble trying to figure out a way to have two columns, one to show the entire formula that can be editable and the second to actually perform the formula.
Ideally, I would like my sheet to be set up like this:
Formula | Value
=5+2 | 7
=3-2 | 1
I would like to be able to change the Formula column and have it automatically update the Value column.
I've tried using the GetFormula() function but I don't think that's what I want to do as I would end up in a circular reference based on what I want to do. The closest I've got is using a Right() function and Text in the formula column or a space and removing the space. However, I end up with the text and not the solved formula instead.
Using =RIGHT(A2, LEN(A2)-1)
Formula | Value
=5+2 | =5+2
I have also tried using =RIGHT(A2,LEN(A2)-1) but without the "=" and can't figure out how to convert the "5+2" into text that I can use to solve. I'm hoping to do this with a formula and without a macro/VBA.
Here is how to do it.
1
Open the Name Manager. Control-F3 from the worksheet, and then click the New button.
2
For the Name field in the dialog, enter EVALA. I just picked this name; it stands for "Evaluate A". But you can pick whatever name you like.
3
For the Refers to field, enter this
=EVALUATE($A1)
4
Click OK and then Close.
5
In B1 enter this formula:
=EVALA
That's it.
You can now use this formula on any row in the worksheet and it will evaluate whatever is in the column A cell of the row where you enter the formula.
You can make a user defined function easily enough with VBA, but if you don't regularly use VBA then an alternative method is to create a Name object. Name objects can access certain functions not typically available in a cell's formula. One of these functions is "Evaluate" which will evaluate a string as a mathematical expression. Here's a demonstration how to do this.
NOTE: Pay special attention to the use of $. Chances are you don't want any $ in your name definition since that will prevent it from behaving in a relative manner. Also, Sheet1! means that this will not work on another sheet.
Update I just want to give credit for this method to the following sources. This is pretty neat stuff, so for anyone interested give it a read. The last link in particular gives a neat example of creating a chart with no data points.
MSDN Evaluating Defined Names
The power of evaluate (ozgrid)
XL4 Macro Functions in Names - JKP
Evaluate and Indirect
More unique functionality of Defined Names
This is probably the best solution for the OP, since it asks to avoid using VBA; however, this method is somewhat limited. It requires manual set-up on every sheet to be used. Much preferable I think is to create a very simple UDF like this...
Function Eval(Expr As String)
Eval = Application.Evaluate(Expr)
End Function
This can be added to any accessible add-in, making it available to any instance of Excel. A little more set-up, but less maintenance.
Just put a single ' before the formula in your A column:
'=5+2 will show in your cell as "=5+2". Then in the B column, just do the formula as normal, =5+2.
please can you tell me how can it be done as i know there are probably several ways of doing it
i have table
so if i want to reduce the qty of a specific product and its type by typing the product and type in another table along with the qty to be subtracted how do i go about it
so far i have used the following function:
=INDEX(A2:J49,MATCH(1,(A2:A40=L12)*(B2:B49=M12),0),5)
but this gives me the value of the qty column based on the product and its type
any help will be highly appreciated
thanks
With out using a macro you cannot change the value of a cell if that cell doesnt have a formula in it
You can create another table, which will show the updated result for product and type, here we will be using the first table as an starting point, adding or subtracting some qtty from the second table, and the result will be shown in thrid table. Otherwise you will be needing VBA code for this task.