- 202
- 85 949
Karl Ernst Buddenbrock
เข้าร่วมเมื่อ 21 มิ.ย. 2016
IF and Switch
The SWITCH function in Excel provides several advantages over using nested IF statements, making it a more efficient and user-friendly option in certain scenarios. Here are the key advantages:
1. Readability and Simplicity
• SWITCH: Easier to read and understand, especially for complex conditions. It organizes the logic more clearly, as it evaluates one expression against multiple values.
• Nested IF: Becomes cumbersome and hard to read as the complexity increases, with many levels of conditions and parentheses.
Example:
• SWITCH:
• =SWITCH(A1, "Red", 1, "Blue", 2, "Green", 3, "Yellow", 4, "Other")
• Nested IF:
• =IF(A1="Red", 1, IF(A1="Blue", 2, IF(A1="Green", 3, IF(A1="Yellow", 4, "Other"))))
2. Maintenance
• SWITCH: Easier to modify. If you need to add or change a condition, you simply add or update a value pair.
• Nested IF: Adding or removing conditions can disrupt the structure and lead to errors, requiring careful rechecking of the logic.
3. Performance
• SWITCH: Evaluates the expression once and compares it against the listed values, which can improve performance when dealing with complex or repetitive calculations.
• Nested IF: May re-evaluate the same expression multiple times, potentially leading to slower performance.
4. Default Value
• SWITCH: Offers a built-in default value for unmatched cases. This eliminates the need for explicitly handling unmatched conditions as with IF.
• Nested IF: Requires an explicit final ELSE condition or a value in the last IF statement to handle unmatched cases.
Example with Default:
• SWITCH:
• =SWITCH(A1, "Red", 1, "Blue", 2, "Other")
• Nested IF:
• =IF(A1="Red", 1, IF(A1="Blue", 2, "Other"))
5. Error Reduction
• SWITCH: Reduces the likelihood of errors caused by mismatched parentheses or complex nesting structures.
• Nested IF: Prone to errors when managing multiple levels of conditions and parentheses.
6. Contextual Suitability
• SWITCH: Best for scenarios where one value is compared against multiple possibilities.
• Nested IF: More versatile for scenarios involving multiple unrelated conditions or complex logical tests.
When to Use Each:
• Use SWITCH for simpler, value-matching cases where the logic is straightforward and concise.
• Use nested IF when the conditions are diverse, unrelated, or require complex logical expressions.
By using SWITCH in the appropriate context, you can make your Excel formulas more efficient, readable, and easier to maintain.
RANGE BASED LOGIC
But remember, The SWITCH function is not inherently designed for range-based logic, as it evaluates exact matches rather than conditions. For range-based logic (e.g., values higher than 100,000 but lower than 200,000), you’ll need to use IFS or IF instead.
However, to attempt a workaround using SWITCH, you'd need to nest it within other logic, but this can quickly become cumbersome. Here’s a practical solution using the IFS function instead (as it's better suited for this task):
Example Using IFS
=IFS(
A1 >200000, A1 * 20%,
A1 >100000, A1 * 10%,
TRUE, 0
)
Explanation:
• A1>200000: If the value is greater than 200,000, multiply it by 20%.
• A1 > 100000: If the value is greater than 100,000 but less than or equal to 200,000, multiply it by 10%.
• TRUE, 0: Acts as the default value, returning 0 if none of the conditions are met.
Why SWITCH Is Less Suitable:
If you still want to attempt a SWITCH workaround, it would require pre-defined categories or helper columns to map ranges to specific values. For direct range evaluation, IFS or IF is cleaner and more straightforward.
1. Readability and Simplicity
• SWITCH: Easier to read and understand, especially for complex conditions. It organizes the logic more clearly, as it evaluates one expression against multiple values.
• Nested IF: Becomes cumbersome and hard to read as the complexity increases, with many levels of conditions and parentheses.
Example:
• SWITCH:
• =SWITCH(A1, "Red", 1, "Blue", 2, "Green", 3, "Yellow", 4, "Other")
• Nested IF:
• =IF(A1="Red", 1, IF(A1="Blue", 2, IF(A1="Green", 3, IF(A1="Yellow", 4, "Other"))))
2. Maintenance
• SWITCH: Easier to modify. If you need to add or change a condition, you simply add or update a value pair.
• Nested IF: Adding or removing conditions can disrupt the structure and lead to errors, requiring careful rechecking of the logic.
3. Performance
• SWITCH: Evaluates the expression once and compares it against the listed values, which can improve performance when dealing with complex or repetitive calculations.
• Nested IF: May re-evaluate the same expression multiple times, potentially leading to slower performance.
4. Default Value
• SWITCH: Offers a built-in default value for unmatched cases. This eliminates the need for explicitly handling unmatched conditions as with IF.
• Nested IF: Requires an explicit final ELSE condition or a value in the last IF statement to handle unmatched cases.
Example with Default:
• SWITCH:
• =SWITCH(A1, "Red", 1, "Blue", 2, "Other")
• Nested IF:
• =IF(A1="Red", 1, IF(A1="Blue", 2, "Other"))
5. Error Reduction
• SWITCH: Reduces the likelihood of errors caused by mismatched parentheses or complex nesting structures.
• Nested IF: Prone to errors when managing multiple levels of conditions and parentheses.
6. Contextual Suitability
• SWITCH: Best for scenarios where one value is compared against multiple possibilities.
• Nested IF: More versatile for scenarios involving multiple unrelated conditions or complex logical tests.
When to Use Each:
• Use SWITCH for simpler, value-matching cases where the logic is straightforward and concise.
• Use nested IF when the conditions are diverse, unrelated, or require complex logical expressions.
By using SWITCH in the appropriate context, you can make your Excel formulas more efficient, readable, and easier to maintain.
RANGE BASED LOGIC
But remember, The SWITCH function is not inherently designed for range-based logic, as it evaluates exact matches rather than conditions. For range-based logic (e.g., values higher than 100,000 but lower than 200,000), you’ll need to use IFS or IF instead.
However, to attempt a workaround using SWITCH, you'd need to nest it within other logic, but this can quickly become cumbersome. Here’s a practical solution using the IFS function instead (as it's better suited for this task):
Example Using IFS
=IFS(
A1 >200000, A1 * 20%,
A1 >100000, A1 * 10%,
TRUE, 0
)
Explanation:
• A1>200000: If the value is greater than 200,000, multiply it by 20%.
• A1 > 100000: If the value is greater than 100,000 but less than or equal to 200,000, multiply it by 10%.
• TRUE, 0: Acts as the default value, returning 0 if none of the conditions are met.
Why SWITCH Is Less Suitable:
If you still want to attempt a SWITCH workaround, it would require pre-defined categories or helper columns to map ranges to specific values. For direct range evaluation, IFS or IF is cleaner and more straightforward.
มุมมอง: 5
วีดีโอ
Xlookup
มุมมอง 814 ชั่วโมงที่ผ่านมา
The XLOOKUP function, introduced in Microsoft Excel 365 and Excel 2019, offers significant advantages over the older VLOOKUP function. Here's a comparison: 1. Search in Any Direction • XLOOKUP: Can search both vertically (columns) and horizontally (rows), replacing the need for both VLOOKUP and HLOOKUP. • VLOOKUP: Only searches vertically in a table, requiring HLOOKUP for horizontal lookups. 2....
Take Function
มุมมอง 7หลายเดือนก่อน
This looks at all the options around the "take" function. Let me mention, however, how I got the data. I recently worked at the largest iron ore opencast mine in the world, and asked the data capturer in the equipment maintenance department to give me some info. The info then allowed me to ask AI the following question: “provide 30 records of data regarding the upgrade and or maintenance of equ...
PowerBI Creating extra table
มุมมอง 352 หลายเดือนก่อน
What if we wanted to create an extra table with months, years and quarters? (This can be done under "transform", but this lesson explains the ins and outs of creating a table)
PowerBI DRILLDOWN AND KPI
มุมมอง 1412 หลายเดือนก่อน
How do we create column charts with drilldown capabilities? This video shows how. Imagine a year level, a quarter level and a month level. The little icon below the graph allows us to switch between the three.
AI and report structure
มุมมอง 483 หลายเดือนก่อน
Sometimes you don't have time to spend long hours on mind maps, brainstorming and construction of an argument in your own capacity. What you then need to do is to use AI and words powerful report structure tools in order to develop the report. This video is an account of how to do that and it manages to teach you the combination of both artificial intelligence [using chachi BT] and Microsoft wo...
Negative variance
มุมมอง 213 หลายเดือนก่อน
Please note that variance column already registers as a negative number if one is spending LESS than the baseline or total cost. Variance does not measure the difference between actual cost and baseline cost. If one wants to register the difference between baseline cost and actual cost go through the following steps: Creating a Custom Field for Cost Variance in MS Project Understanding the Requ...
Conditional Formatting
มุมมอง 293 หลายเดือนก่อน
Microsoft Project does not have traditional "conditional formatting" like you might find in Excel. However, you can achieve similar results by using custom fields with graphical indicators, bar styles, and formatting options to highlight tasks based on specific conditions. Here's the 4th method we offer: 4. Formatting Text Styles - Step 1: Go to the "Format" tab. - Step 2: Select "Text Styles."...
PBI answers
มุมมอง 444 หลายเดือนก่อน
This is for attendees on a basic-intermediate PowerBI course held in Durban 25/26 July 2024. Please note not full answers - just pointers. For the advanced answers, there will be an upcoming video. (all answers here are intermediate; all questions could be answered with basic/intermediate and advanced options for the high flyers).
Overallocation Report
มุมมอง 194 หลายเดือนก่อน
When a Project Management Office (PMO) holds a meeting to discuss cost control, schedule control, and resource control, the agenda might include the following items. See this Video Here are the documents drive.google.com/drive/folders/1vyXN5CdeU-Yi-wC5w34LoSFvgqLImDla?usp=sharing
Report Purpose Statement
มุมมอง 54 หลายเดือนก่อน
The very first stage of creating a report, where the report purpose statement is generated. The criteria of a purpose statement include: Conceptual verb, mini scope, clear, concise, hypothesis.
Delays and Baselines
มุมมอง 175 หลายเดือนก่อน
When it comes to prospect delay analysis, it is necessary to set two baselines. Remember, in Ms. Project there is “baseline”, and there is “baseline one”. These two baselines should be used to compare the before and after effects of the delay. In Microsoft Project, setting a second baseline based on a delay in the project involves a few steps: 1. Ensure the Original Baseline is set: Before sett...
Report Using ChatGPT
มุมมอง 205 หลายเดือนก่อน
How does one use AI to help develop the body of the report? Furthermore, how does one use AI to generate a dataset (which one can change later) for the Appendices?
Measuring CPI
มุมมอง 46 หลายเดือนก่อน
The SECOND metric is Cost Performance Index. CPI is hard core money evaluation of the project’s performance. If the CPI is below 1, then the project is OVERBUDGET. CV, or Cost Variance is by exactly how much. To get back to our bricks analogy, if the project CPI is 0.89 and it is overbudget by 2034 bricks, we’ve used 2034 bricks (wasted them, not laid them, to be clear) more than we had planned...
Earned Value SPI indicator
มุมมอง 266 หลายเดือนก่อน
One of the most ignored but valuable (pardon the pun) measures for a project progress is Earned Value. It is an accurate rendition of the project’s health and status. Think of two metrics. The first is the SPI, or Schedule Performance Index. Is the project AHEAD, ON, or BEHIND schedule? Earned Value measures this and gives an INDEX, the Schedule Performance Index. Furthermore, it provides an ac...
Assigning material resources as a per unit cost
มุมมอง 139 หลายเดือนก่อน
Assigning material resources as a per unit cost
Importing and processing AI data Excel
มุมมอง 1619 หลายเดือนก่อน
Importing and processing AI data Excel
Thank you so much, this really helped me a lot.
@@chellakamina4255 pleasure
Useful tip, Thanks
Brilliant! Thankyou so much!
how did you compute actual weekly?
Thankyou ♥️
Thanks very helpful.
If you have the latest version of Office 365 I found that changing your location cells to a geographical data type in the data tab helps if your Excel isn't initially picking them up.
Thanks a lot Karl i've a project in Data Analysis and you helped me out ♥
Fantastic video Karl. Not sure if you are still monitoring comments, but one issue I have is after selecting filters on the slicer, map is still pointing to the entire pivot range, including blank cells, which is causing an error on the map chart. I noticed you didn’t have this issue when selecting Jennifer who only sold in one state. Any tips would be much appreciated!!!
😇 *promosm*
Great job explaining this process. Thank you.
Great video Karl!
My great appreciation for your very important technical video.
nice trick
Hi Karl, thanks for the video. it helped me greatly. just an query, i am currently working on india , actually getting data for some cities while not for some can you just help me about what might be the issue there? Thanks for the help in advance.
Smart!
Thank you I’m doing a data analytics project and this really helped me through one of the questions!
Pleasure! There are more videos I have uploaded since.
Thanx ❤️
Karl - thanks that was really helpful. I was stuck on making a map chart from a pivot and this worked like a charm with my existing slicers