

























































Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
Este documento contiene una colección de fórmulas para manipular fechas y números en excel. Encontrarás formulas para contar únicos valores, convertir formatos de fechas, calcular días laborales en un año, extracciones de subcadenas y mucho más. Estas fórmulas pueden ser útiles para estudiantes universitarios, aprendices de excel o personas que deseen automatizar tareas en excel.
Tipo: Esquemas y mapas conceptuales
1 / 65
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


























































1. SUM of Digits when cell Contains all Numbers If you cell contains only numbers like A1:= 7654045, then following formula can be used to find sum of digits =SUM(--MID(A1,SEQUENCE(LEN(A1)),1)) =SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)) =SUM(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)) If A1 is blank, then to handle error, you can enclose above formulas into an IFERROR block. 2. SUM of Digits when cell Contains Numbers and non Numbers both If your cell contains non numbers apart from numbers like A1:= 76$5a4b045%d, then following formulas can be used to find sum of digits =SUM(IFERROR(--MID(A1,SEQUENCE(LEN(A1)),1),0)) =SUMPRODUCT((LEN(A1)-LEN(SUBSTITUTE(A1,ROW($1:$9),"")))*ROW($1:$9)) =SUM(IFERROR(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),0)) 3. A List is Unique or Not (Whether it has duplicates) Assuming, your list is in A1 to A1000. Use following formula to know if list is unique. =MAX(COUNTIF(A1:A1000,A1:A1000)) If answer is 1, then it is Unique. If answer is more than 1, it is not unique. 4. Count No. of Unique Values Use following formula to count no. of unique values - =IF(COUNTA(A1:A100)=0,0,COUNTA(UNIQUE(FILTER(A1:A100&"",A1:A100<>"")))) =SUMPRODUCT((A1:A100<>"")/COUNTIF(A1:A100,A1:A100&"")) =SUM((A1:A100<>"")/COUNTIF(A1:A100,A1:A100&"")) 5. Count No. of Unique Values Conditionally If you have data like below and you want to find the unique count for Region = “A", then you can use below formula – Mubarak G haith
If you have more number of conditions, the same can be built after A2:A20 = “A".
6. Generate Sequential Weekday names like Sun, Mon, Tue, .....,Sat For 3 characters Weekday name =TEXT(DATE(2017,1,SEQUENCE(7)),"ddd") =TEXT(DATE(2017,1,ROW($1:$7)),"ddd") (Note – Year 2017 has been used as 1-Jan-2017 was Sunday. You can use any year in place of 2017 where 1-Jan was a Sunday like year 2023) For full Weekday name, replace ddd with dddd =TEXT(DATE(2017,1,SEQUENCE(7)),"dddd") =TEXT(DATE(2017,1,ROW($1:$7)),"dddd") You can add a number if you want to show some other Weekday Name. Say, if you want to show 1 = Monday, 2 = Tuesday…….7 = Sunday, just add 1. Hence, formulas would become =TEXT(1+DATE(2017,1,SEQUENCE(7)),"ddd") =TEXT(1+DATE(2017,1,ROW($1:$7)),"ddd") Mubarak G haith
11. Add Month to or Subtract Month from a Given Date Very often, you will have business problems where you have to add or subtract month from a given date. One scenario is calculation for EMI Date. Say, you have a date of 10/22/ 21 (MM/DD/YY) in A1 and you want to add number of months which is contained in Cell B1. The formula in this case would be =EDATE(A1,B1) [Secondary formula =DATE(YEAR(A1),MONTH(A1)+B1,DAY(A1)) ] Now, you want to subtract month which is contained in Cell B1. =EDATE(A1,-B1) [Secondary formula =DATE(YEAR(A1),MONTH(A1)-B1,DAY(A1)) ] 12. Add Year to or Subtract Year from a Given Date In many business problems, you might encounter situations where you will need to add or subtract years from a given date. Let's say A1 contains Date and B1 contains numbers of years. If you want to add Years to a given date, formulas would be - =EDATE(A1,12B1) =DATE(YEAR(A1)+B1,MONTH(A1),DAY(A1)) If you want to subtract Years from a given date, formulas would be - =EDATE(A1,-12B1) =DATE(YEAR(A1)-B1,MONTH(A1),DAY(A1)) 13. Convert a Number to a Month Name Use below formula to generate named 3 lettered month like Jan, Feb....Dec Mubarak G haith
=TEXT(A1*30,"mmm") Replace "mmm" with "mmmm" to generate full name of the month like January, February....December in any of the formulas in this post.
14. Convert a Month Name to Number Say Cell A1 contains the string January, February….December (or Jan. Feb…..Dec) and you want to show 1, 2…… =MONTH("1"&A1) The formula would work as long as month names are >=3 characters. Hence, it would work for say Janu or Decem or Apri or Octobe. 15. Convert a Number to Weekday Name Suppose you want to return 1 = Sunday, 2 = Monday…..7 = Saturday =TEXT(DATE(2017,1,A1),"dddd") Note – 2017 has been used in above formula as 1-Jan-2017 was Sunday. You can use any year where 1-Jan was Sunday like year 2023. To show only 3 characters of the Weekday Name, replace dddd with ddd =TEXT(DATE(2017,1,A1),"ddd") You can add a number to A1 if you want to show some other Weekday Name Say, if you want to show 1 = Monday, 2 = Tuesday…….7 = Sunday, just add 1 to A =TEXT(1+DATE(2017,1,A1),"dddd") Say, if you want to show 1 = Friday, 2 = Saturday…….7 = Thursday, just add 5 to A =TEXT(5+DATE(2017,1,A1),"dddd") 16. Convert a Weekday Name to Number Say Cell A1 contains the string Sunday, Monday….Saturday (or Sun, Mon…..Sat) and you want to show 1, 2…..7, then following formula can be used to return the numbers. Sunday will be 1 and Saturday will be 7. =ROUND(SEARCH(LEFT(A1,2),"SuMoTuWeThFrSa")/2,0) =MATCH(LEFT(A1,2),{"Su","Mo","Tu","We","Th","Fr","Sa"},0) If we want to return some other number to weekdays, then formula can be tweaked accordingly. For example, to make Mon = 1 and Sun = 7 Mubarak G haith
20. Determine Quarter for Fiscal Year Few countries follow different quarter other than Q1 from Jan-Mar and Q2 for Apr-Jun. In case of Jan-Mar as Q1, formula is simple (if cell A2 is date) =ROUNDUP(MONTH(A2)/3,0) This will give result as 1, 2, 3 & 4 for the quarters. If you want, you can concatenate "Q" in the formula to show Q1, Q2 etc as below ="Q"&ROUNDUP(MONTH(A2)/3,0) If your financial / fiscal year starts in Apr, then for Jan-Mar, quarter is 4 whereas for Apr to Jun, quarter is 1 and so on. In this case, you can use following formula =CEILING(MONTH(EDATE(A1,-3))/3,1) = ROUNDUP(MONTH(EDATE(A1,-3))/3,0) If your financial / fiscal year starts in Jul, then for Jan-Mar, quarter is 3 whereas for Jul to Sep, quarter is 1 and so on. In this case, you can use following formula =CEILING(MONTH(EDATE(A1,-6))/3,1) = ROUNDUP(MONTH(EDATE(A1,- 6 ))/3,0) If your financial / fiscal year starts in Oct, then for Jan-Mar, quarter is 2 whereas for Oct to Dec, quarter is 1 and so on. In this case, you can use following formula =CEILING(MONTH(EDATE(A1,- 9 ))/3,1) = ROUNDUP(MONTH(EDATE(A1,- 9 ))/3,0) 21. Calculate Age from Given Birthday =DATEDIF(A1,TODAY(),"y")&" Years "&DATEDIF(A1,TODAY(),"ym")&" Months "&DATEDIF(A1,TODAY(),"md")&" Days" 22. Convert from dd/mm/yy to mm/dd/yy (DMY to MDY) Say you have following dates in DMY format 24/8/ 24/8/ 4/08/ 04/08/ And you need to convert them into MDY format, then use the following formula Case1 – if your default date format is MDY Mubarak G haith
=FILTERXML(""&SUBSTITUTE(TEXT(A1,"mm/dd/yyyy"),"/","")&"</t
","//s[2]")&"/"&FILTERXML("
","//s[1]")&"/"&FILTERXML(" "&SUBSTITUTE(TEXT(A1,"mm/dd/yyyy"),"/","</s")&"","//s[3]") Case2 – if your default date format is DMY =FILTERXML(" "&SUBSTITUTE(TEXT(A1,"mm/d d/yyyy"),"/","")&""&SUBSTITUTE(TEXT(A1,"dd/mm/yyyy"),"/","")&"</t ","//s[2]")&"/"&FILTERXML("","//s[1]")&"/"&FILTERXML(" "&SUBSTITUTE(TEXT(A1,"dd/mm/yyyy"),"/","</s")&"","//s[3]") "&SUBSTITUTE(TEXT(A1,"dd/m m/yyyy"),"/","")&"
23. Convert from mm/dd/yy to dd/mm/yy (MDY to DMY) Say you have following dates in MDY format 8/24/ 22 8/24/ 8 /0 4 / 08 /0 4 / And you need to convert them into DMY format, then use following formula Case1 – if your default date format is MDY =(FILTERXML(""&SUBSTITUTE(TEXT(A1,"mm/dd/yyyy"),"/","")&"</ t>","//s[2]")&"/"&FILTERXML(""&SUBSTITUTE(TEXT(A1,"mm/dd/yyyy"),"/","")&""&SUBSTITUTE(TEXT(A1,"mm/d d/yyyy"),"/","")&""&SUBSTITUTE(TEXT(A1,"dd/mm/yyyy"),"/","")&""&SUBSTITUTE(TEXT(A1,"dd/mm/yyyy"),"/","")&""&SUBSTITUTE(TEXT(A1,"dd/m m/yyyy"),"/","")&"
If it has decimal minutes say 1415, then you can use following formula to convert it back into time =A1/ If it has decimal seconds say 84900, then you can use following formula to convert it back into time =A1/ (Note – You will need to format your result cell in Time format)
28. Generate a Sequence of Dates Generate 90 sequential dates starting 1-Apr- 21. Let's say that the date is in cell A1. You can use either of following formulas =SEQUENCE(90,,A1) =ROW(INDIRECT(A1&":"&A1+89)) Now, let's generate all dates of a given month. Let's say this is Feb-2021. You can use following formula where A1 has the date 1-Feb- 2021 =SEQUENCE(DAY(EOMONTH(A1,0)),,A1) =ROW(INDIRECT(A1&":"&EOMONTH(A1,0))) Above formulas will generate dates in a column. To generate in a row =SEQUENCE(,90,A1) =TRANSPOSE(ROW(INDIRECT(A1&":"&A1+89))) =SEQUENCE(,DAY(EOMONTH(A1,0)),A1) =TRANSPOSE(ROW(INDIRECT(A1&":"&EOMONTH(A1,0)))) 29. Generate a Sequence of Times Generate 40 sequential times starting at 11 AM with an increment of 15 minutes where A1:=11:00 AM =A 1 +SEQUENCE(40,,,15/(2460)) =A 1 +(ROW(1:40)-1)15/(24*60) 30. How to Know if a Year is a Leap Year Mubarak G haith
Let's say that A1 contains the year. To know whether it is a Leap Year or not, use following formula - =MONTH(DATE(A1,2,29))= =DAY(EOMONTH(DATE(A1,2,1),0))= TRUE means that it is Leap Year and FALSE means that this is not a Leap Year.
31. Last Working Day of the Month If a Date is Given If A1 holds a date, the formula for calculating last Working Day of the month would be =WORKDAY(EOMONTH(A1,0)+1,-1) The above formula assumes that your weekends are Saturday and Sunday. But, if your weekends are different (e.g. in gulf countries), you can use following formula - =WORKDAY.INTL(EOMONTH(A1,0)+1,-1,"0000110") Where 0000110 is a 7 character string, 1 represents a weekend and 0 is a working day. First digit is Monday and last digit is Sunday. The above example is for Gulf countries where Friday and Saturday are weekends. You also have an option to give a range which has holidays. In that case, your formula would become =WORKDAY(EOMONTH(A1,0)+1,-1,D1:D10) =WORKDAY.INTL(EOMONTH(A1,0)+1,-1,"0000110",D1:D10) Where range D1:D10 contains the list of holidays. 32. First Working Day of the Month if a Date is Given If A1 contains a date, then formula for First Working Day of the month would be =WORKDAY(EOMONTH(A1,-1),1) The above formula assumes that your weekends are Saturday and Sunday. But, if your weekends are different (e.g. in gulf countries), you can use following formula - =WORKDAY.INTL(EOMONTH(A1,-1),1,"0000110") Where 0000110 is a 7 character string, 1 represents a weekend and 0 is a working day. First digit is Monday and last digit is Sunday. The above example is for Gulf countries where Friday and Saturday are weekends. Mubarak G haith
If you have got your list of holidays in a range say B1:B20 (B1:B20 should contain dates in date format), you can have following formulas =NETWORKDAYS(DATE(A1,A2,1), EOMONTH(DATE(A1,A2,1),0),B1:B20) =NETWORKDAYS.INTL(DATE(A1,A2,1), EOMONTH(DATE(A1,A2,1),0),"0000110",B1:B20)
35. How Many Mondays or any other Day of the Week between 2 Dates Suppose A1 = 23-Jan-16 and A2 = 10-Nov-16. To find number of Mondays between these two dates =SUM(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=2)) =SUMPRODUCT(--(TEXT(ROW(INDIRECT(A1&":"&A2)),"ddd")="Mon")) =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=2)) =SUMPRODUCT(--(TEXT(ROW(INDIRECT(A1&":"&A2)),"ddd")="Mon")) “Mon" can be replaced with any other day of the week as per need. 36. Find Number of Friday the 13th between Two Given Dates Assume you have been given two dates A1:=1-Jan- 2014 A2:=25-Nov- 2016 You can calculate number of Friday the 13th^ between these two dates by following formula =SUMPRODUCT((WEEKDAY(SEQUENCE(A2-A1+1,,A1))=6)(DAY(SEQUENCE(A2- A1+1,,A1))=13)) =SUMPRODUCT((WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=6)(DAY(ROW(INDIRECT(A 1&":"&A2)))=13)) 37. Calculate Next Working day if date falls on a Weekend / Holiday Suppose you are given a date and you are asked to calculate next working day if date is of weekend. If date is a regular workday, then you should show the same date. For example – 8 - Mar-19 is a working day. Hence, you should show the same date. But if this is either 9- Mar-19 or 10-Mar-19 which are Saturday and Sunday, then you must show 11-Mar-19 as the next workday. In this case, formula to be used would be =WORKDAY(A2-1,1) Mubarak G haith
Assuming, your holidays are in E2:E3, then formula would be =WORKDAY(A2-1,1,$E$2:$E$3) Note – If you are using weekends other than Saturday and Sunday, use WORKDAY.INTL with appropriate parameters.
38. Calculate Previous Working day if date falls on a Weekend / Holiday Suppose you are given a date and you are asked to calculate Previous Working day if date is of weekend. If date is a regular workday, then you should show the same date. For example – 8 - Mar-19 is a working day. Hence, you should show the same date. But if this is either 9-Mar-19 or 10-Mar-19 which are Saturday and Sunday, then you must show 8- Mar-19 as the previous workday. In this case, formula to be used would be =WORKDAY(A2+1,-1) Assuming, your holidays are in E2:E3, then formula would be =WORKDAY(A2+1,-1,$E$2:$E$3) Mubarak G haith