How to parse cells and remove selected data from excel - string

I have this as a few cells in excel 2010:
(source: gyazo.com)
There are a few things I am trying to accomplish, though they're really all variations of the same thing.
In both Price Paid and Price Returned, I have values that can either be formatted as "# (type)" or as an expression of the form "# (type)+# (type2) ...". What I'm trying to do is reduce the expressions from their current state into just numerical values. I've figured out how to do it if it is just the first case ("# (type)"), however I'm having issues with doing the second case, since the parse stops after the first instance of " ". Below I have the code that I'm using in both Numerical Paid and Numerical Returned. The ISNUMBER category is there just to show which things register as numbers and which don't.
Numerical Paid and Numerical Returned Code:
=INT(IF(ISNUMBER(D2),D2,LEFT(D2,FIND(" ",D2,1)-1)))

I did some more google searching and found that someone had already written a VBA function to do this. Lovely.
I've linked the source below.
http://www.vbusers.com/code/codeget.asp?ThreadID=624&PostID=1
All I had to do was replace the ".," with "+-/*", so that it'll handle all operations. Simple, elegant, and useful. Afterwards, I used the solution posted here (as an answer to another one of my questions):
How to make a cell equal to the value of an expression in another cell (Excel 2010)?
to evaluate the resulting string.
Thanks everyone.

Related

FIND() formula to include "implicit intersection operator" change required

Over the weekend, my work laptop did a restart and Microsoft gave me the perfect gift in Excel, it introduced the implicit intersection operator which has completely messed up my world, literally every formula has gone crazy.
I've checked every link I can and cannot work out how to correct even the most basic formula. I would like to ask about this one so I can at least make some progress forwards.
=FIND('Value Definitions'!C3,'User Interface'!K:K) was my formula that was worked forever.
The explanation of this formula is to flag all value definitions that have been used within text of all rows in the user interface column K.
When Excel asks me to correct the formula, it rewrites it as =FIND('Value Definitions'!C3,#'User Interface'!K:K).
This results in #VALUE rather than a number of where the first occurrence was found. If I remove the # then I get #SPILL!.
Just to reiterate the purpose of the formula, I identify which phrases exist in an interface that come from the value definitions worksheet, irrespective of the number value I get (character count of first occurence), I just want to identify that it exists at least once. Then I can use this flag to lookup all related value definitions to be included on the user interface.
Thanks for your help in advance.

How can I check that a string only contains a defined set of substrings by Excel formula?

I have a dictionary containing lots of words - I want the user to be able to input a list of substrings, and then a filtered list will be updated, containing only words that contain those substrings and nothing else. Any words that contain extra characters the user didn't specify, should not appear. Cell F3 will use a FILTER function to create the list. As in the mock-up below:
What I need is a formula that would generate the TRUE or FALSE flags from the yellow section (B3:B9), but I'm not sure how to go about this.
I'm sure this could be solved by VBA or Regex using Google Sheets, but I want to know if there's a way to do this by formula, as I don't want this to require a button press or script execution, and my spreadsheet can't be hosted on Google sheets due to its size. Any ideas?
You can also use a combination of ISNUMBER and SUMPRODUCT:
=ISNUMBER(SUMPRODUCT(MATCH(MID(A3,ROW(INDEX(A:A,1,1):INDEX(A:A,LEN(A3),1)),1),$D$3:$D$5,0)))
Adjusted formula:
=ISNUMBER(SUMPRODUCT(MATCH(MID(A3,ROW(A$1:INDEX(A:A,LEN(A3))),1),$D$3:$D$5,0)))
The result:
The test being ran below is subtracting each instance of your dictionary from the length of original string. If the result is 0, this returns TRUE. If not, this returns FALSE. This is not case sensitive - a & A will be treated equally here.
=NOT(LEN(A1)-(LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),D1,"")))-(LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),D2,"")))-(LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),D3,""))))
The equation works fine although I don't know if it is an optimal solution for you, but posting as answer in case it is for somebody else. The issue with this approach is the equation gets longer and longer for each character you add to your dictionary. Depending on the size of dictionary and strings to test against, this can get sloppy and calc heavy really quick.
Have you considered a UDF in VBA?

Finding the right range from excel table

What is the best way to find the right column for the travelled miles using visual basic coding or some excel function and return the price from that column? HLOOKUP can't be used here because the lookup value isn't exact and the ranges in the table are also not with specific intervals (If they were, I could use e.g. FLOOR(travelled miles/100)*100 and find the price with HLOOKUP). Obviously, it's easy to find the price manually with a small table but with a big table computer will be faster.
Note that, if x is between a and b, then MEDIAN(x,a,b)=x. Combine this with some nested IFs:
=IF(MEDIAN(B5,B1,C1-1)=B5,B2,IF(MEDIAN(B5,C1,D1-1)=B5,C2,IF(MEDIAN(B5,D1,E1-1)=B5,D2)))
I'm on my phone, so just done the first three cases, but hopefully you can see how it continues.
(should note you need to remove the dashes for this to work)
Edit:
I also want to answer your question in the comments above. You can use the following to keep the dash, but get a number to work with.
Assume cell A1 has got the value 10-. We can use the FIND function to work out where the - occurs and then use the LEFT function to only return the characters from before the dash:
=LEFT(A1,FIND("-",A1)-1)
This will return the value 10, but it will return it as a string, not a number - basically Excel will think it is text. To force Excel to consider it as a number, we can simply multiply the value by one. Our formula above therefore becomes:
=(LEFT(A1,FIND("-",A1)-1))*1
You may also see people use a double minus sign, like this:
=--LEFT(A1,FIND("-",A1)-1)
I don't recommend this because it's a bit complex, but combining with the formula above would give:
=IF(MEDIAN(B5,--LEFT(B1,FIND("-",B1)-1),--LEFT(C1,FIND("-",C1)-1)-1)=B5,B2,IF(MEDIAN(B5,--LEFT(C1,FIND("-",C1)-1,--LEFT(D1,FIND("-",D1)-1-1)=B5,C2,IF(MEDIAN(B5,--LEFT(D1,FIND("-",D1)-1,--LEFT(E1,FIND("-",E1)-1-1)=B5,D2)))

Excel 2013 formula throws #Value! error with SAP Business Objects Dashboard

I am using this Excel formula
=IF(C92=0,D102,D101)
It is throwing a #Value! error for my SAP Business Objects Dashboard 4.1 (SP7).
Is there another way to write this formula?
My guess is that SAP does not like using zero for C92=0.
There are several possibilities as to the cause of the error but most will be loosely based upon the fact that you are trying to compare a numerical zero to a cell containing a text string or a blank cell. The cell may even contain a zero as text (e.g. ="0"); a numerical 0 is not the same thing as text-that-looks-like-a-zero.
If you use the VALUE function and wrap some error control around it to accommodate cases when numerical conversion is impossible then you should get consistent results.
=IF(IFERROR(VALUE(C92), 0)=0, D102, D101)
The IFERROR function is used to provide a zero when numerical conversion is not possible. This is my 'best guess' at what you want to occur. Another scenario would be to provide an outside result if not conversion is possible.
=IFERROR(IF(VALUE(C92)=0, D102, D101), "something else")
There are a number of other possibilities. If you have trouble getting the results you expect, please edit your question to include more detail on what outcome(s) you would expect for different case scenarios.

Excel can't find a value even though it exists within the worksheet

this is my first post so i am sorry if this is confusing at all. I am trying to use a vLookup to run a comparative analysis between two reports. I am using a part number as a reference and trying to return the cost associated with the part from one of the two reports. So, the first issue that I encountered was due to the fact that some of the part numbers had letters in them and some didn't, so to be consistent I used the following code to clean up the part numbers:
IFERROR(VALUE(F11&C11), F11&C11)
where F11 and C11 are two components of the part number that needed to be concatenated to generate the full number. Now, the vLookup will not return anything except for #N/A for a few of the part numbers that are actually in the sheet. All of the part numbers are formatted the same for the 892 part numbers that I am searching for but get a returned value on 571 of the 892 part numbers but of the remaining 321 part numbers that did not have a return, about a third actually exist in my sheet. Lastly and for example, part number 110874402 exists in both sheets but gets a #N/A from the vLookup. When I copy the value from one sheet and search it in the other sheet using Ctrl + F, I get the following:
(I have an image to show but apparently can't post it without a reputation of 10 or more...oops)
The highlighted cell shows that the value exists but Excel can't find it. Does anyone have any ideas why this is or what I could be doing differently? I've been having this issue for a few months now on separate projects and haven't found any resolution.
Thanks in advance,
try =VLOOKUP("*"&TRIM(F569)&"*", BOBJ!$D$3:$P$2237, 7, FALSE) - I have a feeling spaces may have crept around the part numbers, which means that the exact match will not work.
The TRIM takes the spaces from the cell you are looking at, and the "*"'s will allow a wildcard search - note that this also means that CAT would also match CAT1, but if it produces results where there were none before, it gives you something to check for.

Resources