SOLVED

Use If formula to subtract different numbers according to a specific word

%3CLINGO-SUB%20id%3D%22lingo-sub-1813213%22%20slang%3D%22en-US%22%3EUse%20If%20formula%20to%20subtract%20different%20numbers%20according%20to%20a%20specific%20word%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1813213%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20build%20a%20tracker%20for%20award%20timelines%20but%20we%20have%20different%20awards%20with%20different%20time%20requirements%20for%20submission.%20For%20a%20service%20award%20it%20needs%20to%20be%20to%20HR%2015%20days%20prior%20to%20today%20but%20if%20it's%20an%20achievement%20award%20it%20needs%20to%20be%20turned%20in%20to%20HR%2030%20days%20prior%20to%20today.%20I%20was%20looking%20to%20see%20if%20there%20was%20a%20way%20to%20use%20the%20If%20function%20to%20subtract%20different%20numbers%20depending%20on%20the%20word%20found%20in%20column%20B.%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20column%20D%20would%20say%20if%20column%20B%20is%20%22service%22%20subtract%2015%20from%20C3%20or%20if%20column%20B%20is%20%22achievement%22%20subtract%2030%20from%20C3.%20This%20would%20allow%20me%20to%20type%20in%20the%20award%20name%20then%20have%20excel%20correctly%20count%20the%20right%20number%20of%20days.%20I%20know%20some%20things%20on%20excel%20but%20anything%20beyond%20basic%20formulas%20are%20hard%20for%20me%20to%20build.%20Thanks%20in%20advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1813213%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1813357%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20If%20formula%20to%20subtract%20different%20numbers%20according%20to%20a%20specific%20word%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1813357%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F843850%22%20target%3D%22_blank%22%3E%40dquack%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20a%20lookup%20table%2C%20for%20example%20on%20another%20sheet%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S3584.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228780iBA1A6EC7AEFFC4EC%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22S3584.png%22%20alt%3D%22S3584.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E2%80%83%3C%2FP%3E%0A%3CP%3EYou%20can%20then%20use%20VLOOKUP%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S3585.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228781iD9BDC30A14E3AEFB%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22S3585.png%22%20alt%3D%22S3585.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20formula%20in%20D3%20is%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DC3-VLOOKUP(B3%2CSheet2!%24A%242%3A%24B%243%2C2%2CFALSE)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I am trying to build a tracker for award timelines but we have different awards with different time requirements for submission. For a service award it needs to be to HR 15 days prior to today but if it's an achievement award it needs to be turned in to HR 30 days prior to today. I was looking to see if there was a way to use the If function to subtract different numbers depending on the word found in column B.

So column D would say if column B is "service" subtract 15 from C3 or if column B is "achievement" subtract 30 from C3. This would allow me to type in the award name then have excel correctly count the right number of days. I know some things on excel but anything beyond basic formulas are hard for me to build. Thanks in advance.

2 Replies
Highlighted
Best Response confirmed by dquack (New Contributor)
Solution

@dquack 

Create a lookup table, for example on another sheet:

 

S3584.png

You can then use VLOOKUP:

 

S3585.png

 

The formula in D3 is

 

=C3-VLOOKUP(B3,Sheet2!$A$2:$B$3,2,FALSE)

Highlighted

@Hans Vogelaar 

Thanks for the help and advice. It has been awhile since I used VLOOKUP and forgot the possibilities with that function. Your help was able to get the excel to work as desired with no issues. Thanks for the quick reply!