Combining 2 IF statements in one - excel

I have these 2 IF statements in 2 seperate cells and would like to make them function in one cell. I have tried a few ways of combining but cannot make it work. Can an IF statement expert help me combine these 2?
1 st.
=IF(K21<0.01,("DTI Ratio Available "&TEXT(K21*-1,"$ 0.00")),("DTI Ratio Short by "&TEXT(K21,"$ 0.00")))
2nd.
=IF(K20<0.01,"Housing Ratio Available "&TEXT(K20*-1,"$ 0.00"),"Housing Ratio Short by "&TEXT(K20,"$ 0.00"))
Thank you very very much

Try this:
=CONCATENATE(
IF(K21<0.01,("DTI Ratio Available "&TEXT(K21*-1,"$ 0.00")),("DTI Ratio Short by "&TEXT(K21,"$ 0.00"))),
" ",
IF(K20<0.01,"Housing Ratio Available "&TEXT(K20*-1,"$ 0.00"),"Housing Ratio Short by "&TEXT(K20,"$ 0.00"))
)

Related

SUM IF when a text string meets a specific numeric value

Okay it might sound weird but I need to calculate points for each employee where:
LT(Tardy) = 0.50 pts
A(Absent) = 1 pt
The table looks like this:
12/1/22 12/2/22 12/3/22 12/4/22 Total Points
A LT LT LT ?
Can I calculate total points in a range where LT is 0.50 pts and A = 1 pt??
Thanks!!
I can not figure out SUMIF to calculate total where a text string meets a specific numeric value
FWIW, you can also use arrays of criteria and values like this:
=SUM(COUNTIF(A2:D2,{"A","LT"})*{1,0.5})
I know, I am late, as the solutions posted by Scott Craner Sir, & Rory Sir are very useful, however sharing one more alternative way.
• Formula used in cell E2
=SUM((A2:D2={"A";"LT"})*{1;0.5})
Let me show you what it creates, before wrapping within SUM()
It creates an array of 2 rows x 4 columns, next we are multiplying by {1;0.5} matrix calculation,
Last but not least to get the counts we are summing the matrix which returns 2.5.
Use COUNTIFS:
=COUNTIFS(A2:D2,"A")+COUNTIFS(A2:D2,"LT")/2
A short one for this specific case (two possible values):
=SUM(IF(A2:D2="A",1,0.5))

Rating scale 1-10

I have survey data with rating survey responses "Excellent", "Very Good"."Good" or Poor. How do I replace these texts in excel with number range - "9-10", "7-8" or "0-6"
=CHOOSE(MATCH(A1,{"Excellent","Very Good","Good","Poor"},0),"9-10","7-8","5-6","0-4")
I made up the numbers, since your question showed 4 options and 3 results only.
This can be done with a simple =IF() construction, something like:
=IF(OR(A1=9,A1=10),"Excellent",
IF(OR(A1=7,A1=8),...),
...
)

How do I calculate the number of years to target in Microsoft Excel

If I have an average YOY growth of say 2.5%, current year sales of $500,000, and target sales of $1,000,000. Is there a way to calculate the number of years until I hit my target (assuming a continued YOY growth rate of 2.5%), without calculating each additional years's sales on a different row?
You can use the NPER function for this:
=NPER(Growth,0,currentSales,-targetSales)
Note that this gives the same result as #Dominique, but is using a built-in Excel function.
Also, by virtue of the nature of Excel financial functions, the signs for the current and future Sales need to be different.
There's a simple formula for this:
Money_end = (1+r/100)^Y*Money_begin
Where:
Money_begin = the starting amount of money, in this case 500000.
Money_end = the finishing amount of money, in this case 1000000.
r = the percent ratio, in this case 2.5.
Y = the amount of years, which you are looking for.
So, your question comes down to solving this equation:
1000000 = (1+2.5/100)^Y * 500000
2 = 1.025^Y
Y = log(2)/log(1.025)
If you want this to be solved by Excel, you might use the formula and use the Solver basic Excel feature for coming up with the same (but numerical instead of analytical) result.

Advance sorting in Excel

In our warehouse we have even/odd system of locations.
here is the example:
1-101-1
1-103-1
1-105-1
....
1-285-1
and
2-102-1
2-104-1
2-116-1
2-240-1
....
2-286-1
and have levels too
1-101-2
1-101-3
1-101-4
there have a lot of data, and I need sort like this:
example numbers:
1-101-1
2-130-1
1-131-1
1-150-2
2-132-3
3-229-5
4-262-1
4-286-5
7-267-1
5-239-1
6-270-1
7-267-3
I need sort like this:
1-101-1
2-130-1
1-131-1
2-132-3
4-286-5
4-262-1
3-229-5
5-239-1
6-270-1
7-267-1
7-267-1
point is first two numbers(1-101-1;2-102-1) goes from smallest to biggest, next two(3-285-1;4-286) goes from biggest to smallest and
5 - 6 goes again from smallest to biggest and with that system to the end
second thing for sort is middle number, that number will goes as first from smallest to biggest, then from biggest to smallest, and last number is level, that is same as level 1 but must be sorted as level one, or be near level 1 if there is 7-267-1 and 7-267-3
is there any solution? thanks
edit:
here is image for easier understanding because it is hard to explain
Thanks all for answers, especially Daniel who are an expert in Excel and understand what I need.
I mean there is not solution for sort like that without VBA, but Daniel show me that i was wrong. Thanks again.
That is what i need, but there are some errors, if you can help me with that
this is other example with other locations:
this is unsorted locations with formulas you give me
and this is sorted, but with bad order:
bad sort
and here is with errors:
errors
we have 120 rows, and numbers bigger then 99 display error, and number 22-250-1 goes in -25 in second row
I try formula with numbers you enter in this example, and i got same good sort as you, but after entering other places, there is some bad sort.
Welcome to StackOverflow!
I think I understand what is being requested. It's a bit difficult to explain but I'll give it a try.
The primary sorting is to be as follows:
If first digit is either 3 or 4, then it should be in descending order else ascending.
If the middle 3-digits are from a 3 or 4 numbered sequence (see #1 above), then the middle pair should be in descending order.
All sequences should be in ascending based on their final digit.
My solution breaks the sequence into distinct columns:
For example, create three columns: First, Second, Third.
Formula for First:
=INT(LEFT(A2, 1))
Formula for Second:
=INT(RIGHT(LEFT(A2,5), 3))
Formula for Third:
=INT(RIGHT(A2,1))
Next, we assign values for sorting these three fields:
Create a column labeled First_Sort_Pair:
=IF(OR(B2=1,B2=2),1,
IF(B2=3,3,
IF(B2=4,2,
IF(OR(B2=5,B2=6),4,
IF(OR(B2=7,B2=8),5,6)))))
Create a column labeled First_Sort:
=IF(OR(B2=3, B2=4), 2, 1)
Create a column labeled Second_Sort:
=IF(E2=4, 2, IF(E2=3, 3, 1))
Create a column labeled Sort_3_4:
=IF(OR(B2=3,B2=4),RANK(C2,C:C,0),)
You can now begin sorting:
[
Result:
You will now have your data sorted as intended:

Binning in Excel

Which formulae in MS Excel can we use for -
equi-depth binning
equi-width binning
Here's what I used. The data I was binning was in A2:A2001.
Equi-width:
I calculated the width in a separate cell (U2), using this formula:
=(MAX($A$2:$A$2001) - MIN($A$2:$A$2001) + 0.00000001)/10
10 is the number of bins. The + 0.00000000001 is there because without it, values equal to the maximum were getting put into their own bin.
Then, for the actual binning, I used this:
=ROUNDDOWN(($A2-MIN($A$2:$A$2001))/$U$2, 0)
This function is finding how many bin-widths above the minimum your value is, by dividing (value - minimum) by the bin width. We only care about how many full bin-widths fit into the value, not fractional ones, so we use ROUNDDOWN to chop off all the fractional bin-widths (that is, show 0 decimal places).
Equi-depth
This one is simpler.
=ROUNDDOWN(PERCENTRANK($A$2:$A$2001, $A2)*10, 0)
First, get the percentile rank of the current cell ($A2) out of all the cells being binned ($A$2:$A$2001). This will be a value between 0 and 1, so to convert it into bins, just multiply by the total number of bins you want (I used 10). Then, chop off the decimals the same way as before.
For either of these, if you want your bins to start at 1 rather than 0, just add a +1 to the end of the formula.
Best approach is to use the built-in method:
http://support.microsoft.com/kb/214269
I think the VBA version of the addin (step 3 with most versions) will also give you the code.
Put this formula in B1:
=MAX( ROUNDUP( PERCENTRANK($A$1:$A$8, A1) *4, 0),1)
Fill down the formula all across B column and you are done. The formula divides the range into 4 equal buckets and it returns the bucket number which the cell A1 falls into. The first bucket contains the lowest 25% of values.
General pattern is:
=MAX( ROUNDUP ( PERCENTRANK ([Range], [TestCell]) * [NumberOfBuckets], 0), 1)
You may have to build the matrix to graph.
For the bin bracket you could use =PERCENTILE() for equi-depth and a proportion of the difference =Max(Data) - Min(Data) for equi-width.
You could obtain the frequency with =COUNTIF(). The bin's Mean could be obtained using =SUMPRODUCT((Data>LOWER_BRACKET)*(Data<UPPER_BRACKET)*Data)/frequency
More complex statistics could be reached hacking around with SUMPRODUCT and/or Array formulas (which I do not recommend since are very hard to comprehend for a non-programmer)

Resources