0
Thanks

A few words of thanks would be greatly appreciated.

Excel - A formula to separate data




Issue


I am trying to make a formula to determine how many days (minus weekends) it took to complet a project. The problem is that I have one employee Alan Bown (initials AB) who works Monday-Friday and a second employee Cristopher Duncan (initials are CD) who work Monday-Thursday. I know that the formula for "AB" would be:
  • SUM(INT((WEEKDAY(B1-{2,3,4,5,6})+C1-B1)/7))

and the formula for "CD" would be:
  • SUM(INT((WEEKDAY(B1-{2,3,4,5})+C1-B1)/7))


If the employee's initials are in cell A1, project start date is in cell B1 and project end date is in cell C1, I want to create a formula that says "if A1 = AB then use this formula, but if A1 = CD then use the other formula"

Solution


Try this
  • =IF(A1="AS",$B$1,IF(A1="BS",$B$2,IF(A1="GS",$B$3,IF(A1="HG",$B$4)))) 
    • Replace the "AS","BS","GS", "HG" with the initials of the employees.
    • Replace the $B$1, $B$2, $B$3, $B$4 with the formulas.


The IF formula is =IF(logic, [if true], [if false]), so I created a nested IF formula.

Thanks to ExcelJosh for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on by deri58.

This document, titled "Excel - A formula to separate data," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments