I need to create a UDF in Excel with complicated if and Or statement.

%3CLINGO-SUB%20id%3D%22lingo-sub-2304357%22%20slang%3D%22en-US%22%3EI%20need%20to%20create%20a%20UDF%20in%20Excel%20with%20complicated%20if%20and%20Or%20statement.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2304357%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20can%20anybody%20help%20with%20an%20Excel%20UDF%20function%20that%20has%20several%20formulas%20depending%20on%20the%20values%20of%20different%20cells%20in%20the%20same%20row%2C%20I%20have%209%20formulas.%20do%20have%20to%20declare%20variables...%3C%2FP%3E%3CP%3EIn%20excel%20as%20a%20sample%20%3A%3C%2FP%3E%3CTABLE%20width%3D%22344%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%22344%22%3E%3DIf%20E2%20%3D%22A%22%20or%20E2%20%3D%22B%22%20and%20J2%26lt%3B24%2C24-J2)%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3DIf%20E2%20%3D%22A%22%20or%20E2%20%3D%22B%22%20and%20P2%26gt%3B16%2C24-(O2%2B(P2-16))%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3DIF%26nbsp%3BE2%20%3D%22A%22%20or%20E2%20%3D%22B%22%20and%20O2%26lt%3B24%2C24-O2)%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3DIF%26nbsp%3BE2%20%3D%22A%22%20or%20E2%20%3D%22B%22%20and%20Q2%26lt%3B24%2C24-(O2%2BQ2))%20etc....%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3EI%20have%20the%20formula%20working%20great%20in%20Excel%20but%20prefer%20if%20possible%20to%20have%20it%20as%20a%20function.%3C%2FP%3E%3CP%3Ethat%20I%20can%20drag%20down%20to%20fill%20the%20column.%20any%20help%20will%20be%20greatly%20appreciated%2C%26nbsp%3B%3C%2FP%3E%3CP%3ECoachz%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2312221%22%20slang%3D%22en-US%22%3ERe%3A%20I%20need%20to%20create%20a%20UDF%20in%20Excel%20with%20complicated%20if%20and%20Or%20statement.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2312221%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1039986%22%20target%3D%22_blank%22%3E%40CoachZ530%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20ask%20this%20Excel%20community%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Fbd-p%2FExcelGeneral%22%20target%3D%22_blank%22%3EExcel%20(microsoft.com)%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello, can anybody help with an Excel UDF function that has several formulas depending on the values of different cells in the same row, I have 9 formulas. do have to declare variables...

In excel as a sample :

=If E2 ="A" or E2 ="B" and J2<24,24-J2)
=If E2 ="A" or E2 ="B" and P2>16,24-(O2+(P2-16))
=IF E2 ="A" or E2 ="B" and O2<24,24-O2)
=IF E2 ="A" or E2 ="B" and Q2<24,24-(O2+Q2)) etc....

I have the formula working great in Excel but prefer if possible to have it as a function.

that I can drag down to fill the column. any help will be greatly appreciated, 

Coachz

2 Replies