If Then else in Excel

Gulfcourse

New Member
Joined
Nov 5, 2023
Messages
32
Office Version
  1. 365
Platform
  1. Windows
I used to use if then else in Crystal Reporting but haven't figured it out in Excel.
I have a column with rows of cells with different percentages in them, let's just say Column Q rows Q2 through Q30.
In Column T, T2 through T30 I would like to put a number based on whats in Q.
Tte numbers in Q range from 2% to 100% and what I want is if
the cell in column Q2 is between 90 and 100 the put 100 in T2
the cell in column Q2 is between 89 and 80 the put 90 in T2
the cell in column Q2 is between 79 and 70 the put 80 in T2
the cell in column Q2 is between 69 and 60 the put 70 in T2
the cell in column Q2 is between 59 and 50 the put 60 in T2
the cell in column Q2 is between 49 and 40 the put 50 in T2
the cell in column Q2 is between 39 and 30 the put 40 in T2
the cell in column Q2 is between 29 and 20 the put 30 in T2
the cell in column Q2 is between 19 and 10 the put 20 in T2
the cell in column Q2 is between 9 and 1 the put 10 in T2

and I would like to do that for all the rows, evaluating the cell in Q and putting the appropriate result in Q, and ideas?
I would like it to look like what I did manually in the image.

Thank you
 

Attachments

  • Screenshot Excel.jpg
    Screenshot Excel.jpg
    37.5 KB · Views: 4

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
So you are basically saying you want to round up to the next highest multiple of 10%.

See formula below. (Hint: this is not an If Then Else problem.)

I made up some quick fake data. For the future, consider pasting your actual data into a post rather than a screenshot.

$scratch.xlsm
AB
15%10%
210.00%10%
315.00%20%
425.00%30%
530.00%30%
635.00%40%
740.00%40%
845.00%50%
950.00%50%
1055.00%60%
1160.00%60%
1265.00%70%
1370.00%70%
1475.00%80%
1580.00%80%
1685.00%90%
1790.00%90%
1890.00%90%
19100.00%100%
Sheet6
Cell Formulas
RangeFormula
B1:B19B1=MROUND(A1+0.001,0.1)
 
Upvote 0
Cell Formulas
RangeFormula
L2,L4,L6:L18,L20:L22,L24:L26L2=SUM(H2-K2)
M2,M4,M6:M18,M20:M22,M24:M26M2=IF(I2,L2/I2,"")
N2,N4,N6:N18,N20:N22,N24:N26N2=L2/K2
Q2,Q4,Q6:Q18,Q20:Q22,Q24:Q26Q2=I2/$S$2
J2,J4,J6:J17,J24:J26,J20:J22J2=IFERROR(H2/I2,0)
I2I2=Playing!D24
I4I4=Playing!D27
I6,I10,I16,I22I6=Playing!D5
I7I7=Playing!D10
I8I8=Playing!D13
I9,I11I9=Playing!D23
I12I12=Playing!D16
I13:I14I13=Playing!D28
I15I15=Playing!D7
I17,I20I17=Playing!D17
I18I18=Playing!D14
K2,K4,K6:K18,K25:K26,K20:K22K2=SUM(I2*6)
I21I21=Playing!D12
I24I24=Playing!D18
I25I25=Playing!D11
I26I26=Playing!D19
V2,V4,V6:V18,V20:V22,V24:V26V2=MROUND(Q2+0.001,0.1)
 
Upvote 0
So it worked, sort of if 90 to 100 it should be 100,
80 to 89, should be 90
70 to 79 should be 80
and so on, your original formula has the 90's as 90's instead of 100, everything else seems fine except for V25 which is 0 instead of ten.

Thank you very much!
 
Upvote 0
Thanks Scott either that didn't work or I'm doing something wrong, which could be the case.
I pasted the formula you gave me into into W2, changed the formula to =MIN(100,ROUNDUP((Q2+1)/10,0)*10) and all I get in column W all the way down is the number 10.
I see your note about xl2bb, I thought I did that, is that simply a standard note or did I screw that up?
Thank you for the help
 
Upvote 0
This does the trick. EDIT: I suggest using CEILING.MATH but the result is the same.

$scratch.xlsm
AB
15%10%
210.00%20%
315.00%20%
425.00%30%
530.00%40%
635.00%40%
740.00%50%
845.00%50%
950.00%60%
1055.00%60%
1160.00%70%
1265.00%70%
1370.00%80%
1475.00%80%
1580.00%90%
1685.00%90%
1790.00%100%
18100.00%100%
Sheet6
Cell Formulas
RangeFormula
B1:B18B1=MIN(1,CEILING(A1+0.001,0.1))
 
Upvote 0
Solution
And here is your data with my formula in NEW

$scratch.xlsm
ABCDEFGHIJKLMN
1# OF ROUNDSAVERAGE PER$$ PUT INTO POTWIN \ LOSS TOTALCOST PER PER ROUND% returnLAST% of Rounds # of RoundsPAY %NEW
236$10.78 216$172 $4.78 79.63%Roderick100.00%36100%100.00%
3
424$10.17 144$100 $4.17 69.44%Theberge66.67%70%70.00%
5
614$9.36 84$47 $3.36 55.95%Bonham38.89%40%40.00%
716$8.63 96$42 $2.63 43.75%Frederick44.44%50%50.00%
825$6.60 150$15 $0.60 10.00%Gressell69.44%70%70.00%
926$6.54 156$14 $0.54 8.97%Petro72.22%80%80.00%
1028$6.54 168$15 $0.54 8.93%Edmisten77.78%80%80.00%
1134$6.21 204$7 $0.21 3.43%Sepic94.44%100%100.00%
1234$6.18 204$6 $0.18 2.94%Keep94.44%100%100.00%
1327$5.37 162($17)($0.63)-10.49%Wallon75.00%80%80.00%
1433$5.21 198($26)($0.79)-13.13%Zeman91.67%100%100.00%
1528$5.07 168($26)($0.93)-15.48%Dangerfield77.78%80%80.00%
1631$5.00 186($31)($1.00)-16.67%Hobbs86.11%90%90.00%
1726$4.77 156($32)($1.23)-20.51%Kilroy72.22%80%80.00%
18212($4)($2.00)-33.33%Hibjan5.56%10%10.00%
19
2032$3.47 192($81)($2.53)-42.19%Nassar88.89%90%90.00%
213$3.33 18($8)($2.67)-44.44%Gosnell8.33%10%10.00%
2224$3.00 144($72)($3.00)-50.00%Nigro66.67%70%70.00%
23
24250.5633-19($0.76)-57.58%Lincoln69.44%70%70.00%
252$2.00 12($8)($4.00)-66.67%Funari5.56%10%10.00%
261$0.00 6($6)($6.00)-100.00%Moderick2.78%10%10.00%
Sheet5
Cell Formulas
RangeFormula
N2,N24:N26,N20:N22,N6:N18,N4N2=MIN(1,CEILING.MATH(I2+0.001,0.1))
 
Upvote 0
Thank you, Thank you, Thank you, I'm blown away at the help an novice Excel user gets at this site and I'm continually learning along the way.
The only problem is the more I learn the more I realize I don't know!
Thanks again to all for the help!
 
Upvote 0

Forum statistics

Threads
1,223,944
Messages
6,175,554
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top