Find or If formula

rockyw

Well-known Member
Joined
Dec 26, 2010
Messages
1,196
Office Version
  1. 2010
Platform
  1. Windows
If I have Road number in A, The number of miles for the road in B, In D I want to enter the road I mowed, in E the number of miles I mowed on that road.
How can I find the road and miles and subtract from B and total in C. Would I use a match or find formula? The roads may be entered several times before the entire road is mowed.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

It would help us to understand better if you could provide some sample data, including some values entered in D and E, with the expected results calculated and entered manually in C and provide any further clarification in relation to that sample data. I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

Do you only want a macro solution, or would a formula solution be okay if one is possible?
 
Upvote 0
In D write the road in. I E the miles mowed. In C would show miles left based on miles in B for each road. A formula would be fine. I tried many just cant get it to work. Thanks
 

Attachments

  • Workbook-1.jpg
    Workbook-1.jpg
    123.3 KB · Views: 7
Upvote 0
  • Thanks for updating your version details. (y)

  • Unfortunately, we cannot copy from an image to test, hence my request for XL2BB

  • I don't understand the example. It looks like you have mowed 2 miles of road 65. If that is so, why is there only 2 miles left to go when road 65 is 5 miles long. :confused:

  • Also, you originally mentioned that roads may be mentioned several times before completely mowed. Your example gives no indication of how that would be managed in columns C:E
 
Upvote 0
Agree with @Peter_SSs , the header name of column C is bit misleading as the number reflects the miles mowed, and not the remaining miles not yet mowed.

1690608082063.png

If you want column C to show the miles mowed, you could enter below formula into cell C2 then copy the formula down:
Excel Formula:
=SUMIF($E:$E,$A2,$F:$F)

If you want column C to show the remaining miles not yet mowed, you can enter below formula into cell C2 then copy the formula down :
Excel Formula:
=B2-SUMIF($E:$E,$A2,$F:$F)

Would this work?
 
Upvote 0
Solution
OK thanks for the replies, I wasn't very clear. Id like to write in the road in D and miles in E. In C Id like to show the miles left for that road. So it would subtract the miles in B for each road and show what's left in C. I tried to copy selected range with the add in. Hope this is correct.

Twp Roads.xlsx
ABCDE
1RdMilesLeftMowedMiles
21011655
32744
42833
52922
63011
73122
83233
96055
106133
116211
126550
13
14Total Miles30
15
16
17
18
19
20
21
22
23
24
25Done5
26Left25
Sheet1
Cell Formulas
RangeFormula
B14B14=SUM(B2:B13)
E25E25=SUM(E2:E24)
E26E26=30-E25
 
Upvote 0
In that case, you should be able to use this formula
Excel Formula:
=B2-SUMIF($D:$D,$A2,$E:$E)

Enter into cell C2 and copy down for rest of cells in column C. See if this works for you?
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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