How to use a reference function in place of an IF function?

moniqua33

New Member
Joined
Feb 6, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I am trying to find out adoption rates by using a reference function instead of the IF functions that I used in O11. Is there a formula that would work for this? It needs to be copied down the column like my IF formula. Thank you!

Book3
ABCDEFGHIJKLMNOP
1Rabies cost/shot$ 25.00
2immunization cost/shot$ 18.00Adoption Rates
3food and body weight80%Age (mos)Amount
4cost food/pound dog$ 0.865$ 200.00
5shot treat cost$ 2.0011$ 160.00
612$ 65.00
7
8
9Adopted DogsExpense CalculationsRevenue
10NameAge (in months)Weight (in pounds)SexCityRabies shot?Number of ImmunizationsCustomerID Rabies shot cost Immunization costs Total cost shots Food cost Treat cost Total costs Adoption CostProfit
11Ace426MColumbusTRUE124$ 25.00$ 18.00$ 43.00$ 40.25$ 2.00$ 85.25$ 65.00$ 20.25
12Yoda16213MColumbusTRUE328$ 25.00$ 54.00$ 79.00$ 148.26$ 6.00$ 233.26$ 65.00$ 168.26
13Toby17116MDublinFALSE123$ -$ 18.00$ 18.00$ 158.07$ 2.00$ 178.07$ 65.00$ 113.07
14Fluffy104FColumbusTRUE121$ 25.00$ 18.00$ 43.00$ 11.35$ 2.00$ 56.35$ 160.00$ (103.65)
15Daisy52FWorthingtonTRUE211$ 25.00$ 36.00$ 61.00$ 5.68$ 4.00$ 70.68$ 200.00$ (129.32)
16Corky33FDublinFALSE143$ -$ 18.00$ 18.00$ 4.64$ 2.00$ 24.64$ 200.00$ (175.36)
17Scruffy145FWorthingtonFALSE245$ -$ 36.00$ 36.00$ 15.48$ 4.00$ 55.48$ 65.00$ (9.52)
18Lady103FWorthingtonFALSE22$ -$ 36.00$ 36.00$ 10.66$ 4.00$ 50.66$ 160.00$ (109.34)
19Bailey1747FWorthingtonFALSE242$ -$ 36.00$ 36.00$ 154.46$ 4.00$ 194.46$ 65.00$ 129.46
20Marley32FColumbusFALSE126$ -$ 18.00$ 18.00$ 3.96$ 2.00$ 23.96$ 200.00$ (176.04)
21Bear6616MColumbusFALSE122$ -$ 18.00$ 18.00$ 67.77$ 2.00$ 87.77$ 65.00$ 22.77
22Bruno75MColumbusFALSE313$ -$ 54.00$ 54.00$ 9.46$ 6.00$ 69.46$ 160.00$ (90.54)
23Alex4217FColumbusFALSE347$ -$ 54.00$ 54.00$ 47.82$ 6.00$ 107.82$ 65.00$ 42.82
24Copper115MColumbusFALSE348$ -$ 54.00$ 54.00$ 12.90$ 6.00$ 72.90$ 160.00$ (87.10)
25Lucky786FColumbusFALSE114$ -$ 18.00$ 18.00$ 71.21$ 2.00$ 91.21$ 65.00$ 26.21
26Alfie21FDublinTRUE03$ 25.00$ -$ 25.00$ 2.41$ -$ 27.41$ 200.00$ (172.59)
27Rocky63MColumbusFALSE210$ -$ 36.00$ 36.00$ 7.22$ 4.00$ 47.22$ 160.00$ (112.78)
28Allegra83MHilliardFALSE030$ -$ -$ -$ 8.94$ -$ 8.94$ 160.00$ (151.06)
29Chance23MColumbusTRUE031$ 25.00$ -$ 25.00$ 3.78$ -$ 28.78$ 200.00$ (171.22)
30Milo888MHilliardFALSE332$ -$ 54.00$ 54.00$ 81.18$ 6.00$ 141.18$ 65.00$ 76.18
31Alvin2815MColumbusTRUE133$ 25.00$ 18.00$ 43.00$ 34.40$ 2.00$ 79.40$ 65.00$ 14.40
32Amadaous 63MHilliardTRUE034$ 25.00$ -$ 25.00$ 7.22$ -$ 32.22$ 160.00$ (127.78)
33Amber125FColumbusTRUE035$ 25.00$ -$ 25.00$ 13.76$ -$ 38.76$ 65.00$ (26.24)
34Teddy85MColumbusTRUE236$ 25.00$ 36.00$ 61.00$ 10.32$ 4.00$ 75.32$ 160.00$ (84.68)
35Ameila 17311FColumbusTRUE037$ 25.00$ -$ 25.00$ 156.35$ -$ 181.35$ 65.00$ 116.35
36Champ305MColumbusFALSE338$ -$ 54.00$ 54.00$ 29.24$ 6.00$ 89.24$ 65.00$ 24.24
37Amy113FColumbusTRUE339$ 25.00$ 54.00$ 79.00$ 11.52$ 6.00$ 96.52$ 160.00$ (63.48)
38Molly104FColumbusTRUE340$ 25.00$ 54.00$ 79.00$ 11.35$ 6.00$ 96.35$ 160.00$ (63.65)
39Prince21MGahannaFALSE041$ -$ -$ -$ 2.41$ -$ 2.41$ 200.00$ (197.59)
40Bella666FColumbusTRUE325$ 25.00$ 54.00$ 79.00$ 60.89$ 6.00$ 145.89$ 65.00$ 80.89
41Andy1213MColumbusFALSE244$ -$ 36.00$ 36.00$ 19.26$ 4.00$ 59.26$ 65.00$ (5.74)
42Angelica42FWorthingtonTRUE16$ 25.00$ 18.00$ 43.00$ 4.82$ 2.00$ 49.82$ 200.00$ (150.18)
43Lola11212FColumbusFALSE37$ -$ 54.00$ 54.00$ 104.58$ 6.00$ 164.58$ 65.00$ 99.58
44Charlie4115MColumbusTRUE29$ 25.00$ 36.00$ 61.00$ 45.58$ 4.00$ 110.58$ 65.00$ 45.58
45Laddie43MDublinTRUE148$ 25.00$ 18.00$ 43.00$ 5.50$ 2.00$ 50.50$ 200.00$ (149.50)
46Apollo11MColumbusTRUE017$ 25.00$ -$ 25.00$ 1.55$ -$ 26.55$ 200.00$ (173.45)
47Lanie43FColumbusFALSE05$ -$ -$ -$ 5.50$ -$ 5.50$ 200.00$ (194.50)
48Sport9015MWorthingtonTRUE016$ 25.00$ -$ 25.00$ 87.72$ -$ 112.72$ 65.00$ 47.72
49Jamie11MHilliardFALSE018$ -$ -$ -$ 1.55$ -$ 1.55$ 200.00$ (198.45)
50Rio94MColumbusTRUE337$ 25.00$ 54.00$ 79.00$ 10.49$ 6.00$ 95.49$ 160.00$ (64.51)
51Beau104FHilliardFALSE017$ -$ -$ -$ 11.35$ -$ 11.35$ 160.00$ (148.65)
52Coco12FWorthingtonFALSE019$ -$ -$ -$ 2.24$ -$ 2.24$ 200.00$ (197.76)
53Scout114MColumbusTRUE329$ 25.00$ 54.00$ 79.00$ 12.21$ 6.00$ 97.21$ 160.00$ (62.79)
54Sugar32FColumbusTRUE015$ 25.00$ -$ 25.00$ 3.96$ -$ 28.96$ 200.00$ (171.04)
55Ariel12FDublinFALSE04$ -$ -$ -$ 2.24$ -$ 2.24$ 200.00$ (197.76)
56Zoey73MDublinTRUE241$ 25.00$ 36.00$ 61.00$ 8.08$ 4.00$ 73.08$ 160.00$ (86.92)
57Rusty41MColumbusTRUE05$ 25.00$ -$ 25.00$ 4.13$ -$ 29.13$ 200.00$ (170.87)
58Snow84MColumbusFALSE312$ -$ 54.00$ 54.00$ 9.63$ 6.00$ 69.63$ 160.00$ (90.37)
59Indy128FDublinTRUE332$ 25.00$ 54.00$ 79.00$ 15.82$ 6.00$ 100.82$ 65.00$ 35.82
60Shadow84MColumbusTRUE38$ 25.00$ 54.00$ 79.00$ 9.63$ 6.00$ 94.63$ 160.00$ (65.37)
61
62Number of dogs needing Rabies shots26TOTAL$ (3,116.19)
63
64CityAverage Profit$ (37,394.26)
65Columbus$ (43.89)
66Dublin$ (90.46)
67Gahanna$ (197.59)
68Hilliard$ (109.95)
69Worthington$ (59.85)
70TOTALS$ (501.74)
71
Adopted Dogs
Cell Formulas
RangeFormula
I11:I60I11=IF(F11,$B$1,0)
J11:J60J11=PRODUCT(G11,$B$2)
K11:K60K11=SUM(I11,J11)
L11:L60L11=SUM(C11*$B$3,B11)*$B$4
M11:M60M11=PRODUCT(G11,$B$5)
N11:N60N11=SUM(K11,L11,M11)
O11:O60O11=IF(B11<=$E$4,$F$4,IF(B11<=$E$5,$F$5,IF(B11>=$E$6,$F$6)))
P11:P60P11=N11-O11
B62B62=COUNTIF(F11:F60,TRUE)
P62P62=SUM(P11:P60)
P64P64=AVERAGE(P62*12)
B65:B69B65=AVERAGEIFS(P11:P60,E11:E60, A65)
B70B70=SUM(B65:B69)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Upvote 0
Solution
Since the other values in that lookup table are the upper value of the range, another option would be just to change the yellow cell so that it is too, and then use the formula shown in column O

22 02 12.xlsm
BEFO
125
218Adoption Rates
30.8Age (mos)Amount
40.865200
5211160
6200065
7
8
9Revenue
10Age (in months)CityRabies shot?Adoption Cost
1142ColumbusTRUE65
12162ColumbusTRUE65
13171DublinFALSE65
1410ColumbusTRUE160
155WorthingtonTRUE200
163DublinFALSE200
1714WorthingtonFALSE65
1810WorthingtonFALSE160
19174WorthingtonFALSE65
203ColumbusFALSE200
2166ColumbusFALSE65
227ColumbusFALSE160
2342ColumbusFALSE65
2411ColumbusFALSE160
2578ColumbusFALSE65
262DublinTRUE200
276ColumbusFALSE160
288HilliardFALSE160
292ColumbusTRUE200
Lookup
Cell Formulas
RangeFormula
O11:O29O11=XLOOKUP(B11,E$4:E$6,F$4:F$6,,1)
 
Upvote 0
Hi,

Does this work for you.
Change your E4:E6 table values as shown, use O11 formula copied down:

Adoption Rates
Age (mos)Amount
0200
6160
1265


Book3.xlsx
O
10Adoption Cost
1165
1265
1365
14160
15200
16200
1765
18160
1965
20200
2165
22160
2365
24160
2565
26200
27160
28160
29200
3065
3165
32160
3365
34160
3565
3665
37160
38160
39200
4065
4165
42200
4365
4465
45200
46200
47200
4865
49200
50160
51160
52200
53160
54200
55200
56160
57200
58160
5965
60160
Sheet1002
Cell Formulas
RangeFormula
O11:O60O11=LOOKUP(B11,E$4:E$6,F$4:F$6)

Hi there,

This code gives me NA errors for certain values.

Cell Formulas
RangeFormula
O11:O60O11=LOOKUP(B11,E$4:E$6,F$4:F$6)
P11:P60P11=N11-O11
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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