How to sum numbers with text appended in the same cell [Excel]? - excel

I've tried summing numbers for the entire column by using the sum() function but I get 0 as an answer due to a string present.
Example :
1.99 USD
22.37 USD
2.49 USD
1.69 USD
Is there a function that only calculates/sum the number?
Thanks

Get rid of the USD from the values in the cell and use a custom number format of,
0.00 \U\S\D
Then sum the raw numerical values.

How about:
=SUMPRODUCT(--SUBSTITUTE(A1:A4," USD",""))

A quick and dirty solution (if you just want to sum them up, without further computations) would be to use the "Search and Replace" function CTRL+H. Silly me for not realizing this earlier.
In my case, it's " USD" with a blank space in front (ignore the open-inverted commas) and inserting nothing at all in the "replace with" parameter.

Related

Subtract next number in sequence from the one before excel

I want to subtract the next number in the sequence from the previous number so 2 from 1, 4 from 3 and so on. Ideally, it would find those "pairs" and then subtract the time from that row so I also need a way to do that
Assuming there are no sequential "START" options for the same behavior; Something along these lines:
Formula in F2:
=IF(D2="START",XLOOKUP(C2,C3:C$11,B3:B$11)-B2,"")
If I understand well, you want to subtract the timestamps when the status equals "STOP" and the previous status equals "START". For such situation, you might use the following formula:
=IF(AND(D2="START",D3="STOP"),B3-B2,"")
This puts the time difference in that particular case and a blank cell in the other case, resulting in something like this:
Difference
<BLANK>
9.8
<BLANK>
21.3
<BLANK>
12.8
...
(Keep in mind that I've used rounded values, which are slightly different than yours)

Define List that Changes

I have a list of time records that have 1 digit, 1 decimal, 2 digits, and an "hrs" description.
I'm looking to only get the first 4 characters of my list. But my list isn't constant so I can't write a VBA code to backspace records from A2:A100 (example range).
I need help defining my list (because the range of records changes) and then keystroking three backspaces for every value in my list. The reason I use three backspaces is because I can use a color scale on my new list that is now stored as a Number.
Below is a snippet of what I'm working with:
Original List New List (I will use a color scale)
1.96 hrs 1.96
1.73 hrs 1.73
0.00 hrs 0.00
1.90 hrs 1.90
I will also consider simply being able to use a color scale on my original list. My only guess in achieving this would be to format the values on my original list as Numbers. However, I've tried changing the formatting but I still can't use a color scale.
Any help would be greatly appreciated!
You shouldn't need VBA. You can just use built-in formulas.
First four characters, converted to value:
=VALUE(LEFT(A2, 4))
Replace " hrs", convert to value:
=VALUE(SUBSTITUTE(A2, " hrs"))
There are lots of other ways to do it.

excel if statement having a range in a single cell

At the moment I am working on using on implementing nested if statement in excel for a project. It involves calculating the tax of employees using a tax table and would like to know if it possible for a logical test to distinguish a range within a singular cell i.e $0-$18,000
If you are open to using VLOOKUP, you can create a table showing the range and the associated value with it and use vlookup with the last argument being TRUE (approximate match) to get the value.
This is the output:
1.00 10%
100,000.00 30%
40,000.00 25%
17,999.00 10%
18,000.00 10%
18,001.00 15%
Try nested IF and AND formulas in combination. For example, there are three ranges: 0-18 000, 18 000- 23 000, 23 000<, then use this:
=IF(AND(A1>=0, A1<=18000),"range 1",IF(AND(A1>18000, A1<=23000),"range 2","range 3"))

Calculating my tax automatically in Excel

It's my very first post here so hi all.
I did a lot of research before hand but couldn't find the answer I was looking for.
I want a spreadsheet in Google Sheets to automatically calculate my tax.
€0 - €11000 w/ 0%
€11000 - €18000 w/ 25%
€18000 - €31000 w/ 35%
€31000 - €60000 w/ 42%
€60000 - €90000 w/ 48%
€90000 - €1000000 w/ 50%
€1000000+ w/ 55%
So the first 11k are taxed with 0% the next 7k are taxed with 25% etc.
What I've had the following thought - give that F9 are my before tax earnings:
=IF(0<=F9<=11000,SUM(F9*0%),(IF(11000<F9<=18000,SUM((F9-11000)*25%),(IF(18000<F9<=31000,SUM((7000*25%)+((F9-18000)*35%),SUM(F9))))))
Unfortunately it just won't work.
Am I using the right function?
Is there anything out there which would make it much easier?
Thank you for your help.
Here is an example (Excel) for your problem:
In Cell A1 is your Money, paste the code in A2 for example:
=WENN(A1>10000;"10%";WENN(A1>7000;"7%";WENN(A1>5000;"5%";WENN(A1>3000;"3%";"0%"))))
FK
Excel does not work that way X<y<z. Plus it resolves in order so it is not necessary:
=IF(F9<=11000,SUM(F9*0%),(IF(F9<=18000,SUM((F9-11000)*25%),(IF(F9<=31000,SUM((7000*25%)+((F9-18000)*35%),SUM(F9))))))
if it is less than 11000 then the first will fire and none others. then if greater than 11000 but less than 18000 the second will fire, and so on.
List values of each bracket range with the percentage applied if it is above that amount, for example:
A B
1 11000 0.25
2 18000 0.35
3 31000 0.42
4 60000 0.48
5 90000 0.50
6 1000000 0.55
You can format the percentage values as percentages if you prefer. What is important is that the value is a decimal and not a string.
Then you can use the MATCH function to determine the row of the first value that is larger than your income. So if the cell holding your income is F9, you'd have:
=MATCH(F9;A1:A6;1)
But this only returns the row number. If we want to retrieve the tax applied, we'll need to use this to pinpoint the value in column B pertaining to that. To get a value pertaining at a certain point dynamically, we use INDEX.
So putting it together, you'd have:
=INDEX(B1:B6; MATCH(F9; A1:A6; 1); 1)
One minus this times the value in F9 to get the amount after taxes:
=F9*(1 - INDEX(B1:B6; MATCH(F9; A1:A6; 1); 1))
Why would you do it this way? It lets you change the values in an intuitive fashion without having to parse a long and arduous formula. You can also add new values with relative ease. Just remember to adjust the A1:A6 and B1:B6 ranges.
Good luck! Let me know how it turns out!
You might want to try this:
=if(F9<=0,"Error",IF(F9<=11000,0,(IF(F9<=18000,(F9-11000)*25%,(IF(F9<=31000,1750+(F9-18000)*35%,IF(F9<=60000,6300+(F9-31000)*0.42,if(F9<=90000,18480+(F9-60000)*0.48,IF(F9<=1000000,32880+(F9-90000)*0.5,487880+(F9-1000000)*0.55)))))))))

VLookup of a VLookup

All the single use VLOOKUP formulas work perfectly, but the formula below is a nested VLOOKUP and always fails.
=VLOOKUP(VLOOKUP(V2,PRAISe,2,FALSE)-VLOOKUP(D2,PRAISe,2,FALSE),Progress,2,FALSE)
When I step thought the formula the nested VLOOKUPS work fine and resolve to the correct decimal value. When the top level vlookup searches for that decimal value I always get a no value found error.
The lookup ranges are as follows:
PRAISE Lookup
1- 1.20
1+ 1.80
1= 1.50
2- 2.20
2+ 2.80
2= 2.50
etc. etc.
Grade Lookup
1.20 1-
1.50 1=
1.80 1+
2.20 2-
2.50 2=
2.80 2+
etc. etc.
Progress
0.00 0
0.30 1
0.60 2
0.90 3
1.20 4
etc. etc.
Things I have tried.
At first I thought it was due to the decimal places and an exact match problem, so I multiplied all my results by 10, so I was only working with whole numbers. Unfortunately I got the same result.
I have also tried spitting the formula across two columns. Again the subtraction works and resolves to a decimal number. However when I then try and look that number up as a separate statement it still fails.
This may be due to the way that numbers are stored in Excel. If you round the subtraction or use TRUE as the last argument in the outer lookup, the formulas seem to work. I changed V2 to A2 for sake of the screenshot.
=VLOOKUP(ROUND(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),1),Progress,2,FALSE)
=VLOOKUP(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),Progress,2,TRUE)
But there are combinations where the subtraction of the VLookup does not have an exact match in the Progress table, for example 2+ returns 2.8 and 1- returns 1.2. The subtraction result is 1.6 and a Vlookup with FALSE on the Progress table will return an error, while the vlookup with TRUE as the last parameter will return the next smallest match.
So check your V2 and D2 cells for combinations that are not found, and determine if you can get away with rounding or if you need to use TRUE in the outer lookup.
Aren't you missing some parenthesis in there to make it clear to the formulas the order of operations you intend?
=VLOOKUP((VLOOKUP(V2,PRAISe,2,FALSE))-(VLOOKUP(D2,PRAISe,2,FALSE)),Progress,2,FALSE)

Resources