+ Reply to Thread
Results 1 to 31 of 31

Need Help with IF Function,And Function & Mod Function

  1. #1
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Need Help with IF Function,And Function & Mod Function

    Good Evening,,,

    First of all, I would like to express my admiration for this forum and I hope to add value- even is simple-.

    In fact, I have a question and hope to find an answer for it, my question is as follows:-

    How can I use an IF Function containing more than multipier, simply we offer discounts at a different rates according to ( sales amount & its multiplier , I need to have an equation that determines if the sales amount typed in cell met the condition, it will be written as it is, if doesn't meet the condition, error message are shown.

    currently I'm using more than equation for each sales segment separately, and I hope to have SINGLE equation for all rates.

    in attachment you will find excel sheet that shows that.

    Thanks in Advance,,,
    Sales Discount Amount_More Than Multiplier.xlsx








    Update_001

    Thanks for replying to me and I'm sorry for forgetting to mention the equations.
    in the attachment, you will find the excel sheet ( real).

    Thanks in Advance,,,

    Update_001_Sales Discount Amount_More Than Multiplier.xlsx
    Last edited by Mohamed_Adel_; 12-18-2023 at 04:29 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    Please add examples of some manually-calculated expected results.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    The Excel sheet has been edited, please go back to the original post.

    thanks in advance,,,

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    If Sales Amount is in C1 then you cannot have the validation formula in the same cell.

    And where are the expected results ? NIL in column G is not very helpful.
    Last edited by JohnTopley; 12-18-2023 at 05:03 PM.

  5. #5
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    in Column C, we can use " Data validation" from ( data tab ), the objective is just to control the input amount, not to enter any amount.

    please have a look at the attachments.

    Thanks in Advance,,,

  6. #6
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function


  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    Attachment cannot be viewed


    Guessing ......with Sales Amount in C1

    in D1 Or where ever)

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by JohnTopley; 12-19-2023 at 11:09 AM.

  8. #8
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    the suggested equation doesn't meet the condition of ( multiplier ) , if you enter any amount, it ignores it.

    please check the (multiplier condition ) in the Mod function and compare it with the original one.

    Thanks in advance,,,

  9. #9
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    If you enter any amount, whatever is it, for example( 330 or 250.50, ......etc), unfortunately, no error messages are shown, however, the minimum amount to enter is 1000, and NOT less than 1000 is acceptable.

    the equation is true except ( multiplier condition ), just to activate the option of validating the input amount ( the minimum amount is 1000).

    Thanks in Advance,,,

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    Error in original formula!

    Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    Thank you so much for helping, I actually tried the new equation, and unfortunately, there is only one problem which is as follows:-

    if you try to input an amount ( 250000) and its multiplier (10000), it doesn't work, however, the input amount is correct
    all other conditions are working.

    The new equation that I'm using after I updated it according to ( multiplier ):-


    IF(AND(C1<100000,MOD(C1,1000)=0),C1,IF(AND(C1<250000,MOD(C1,10000)=0),C1,IF(AND(C1<1000000,MOD(C1,100000)=0),C1,IF(AND(C1<3000000,MOD(C1,100000)=0),C1,IF(MOD(C1,100000)=0,C1,"Invalid Amount")))))


    Thanks in Advance,,,

  12. #12
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Need Help with IF Function,And Function & Mod Function

    Mohamed, it is really a bad practice to use empty columns and row to divide a table, in the attached file I offer a correction.

    Also it seams to me that you are doing a circular reference.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    Another typo by me: the multiplier in my formula was 1000 not 10000: zero blind!

  14. #14
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,060

    Re: Need Help with IF Function,And Function & Mod Function

    Try this formula,
    G7=IF(AND($C$1>=--TRIM(LEFT(SUBSTITUTE(TRIM(C7)," ",REPT(" ",100)),100)),MOD($C$1,--TRIM(MID(SUBSTITUTE(TRIM(C7)," ",REPT(" ",100)),FLOOR(LEN(SUBSTITUTE(TRIM(C7)," ",REPT(" ",100))),100),FLOOR(LEN(SUBSTITUTE(TRIM(C7)," ",REPT(" ",100))),100)+100)))=0),$C$1*E7,"Nil"), copy down.

    Agreed with DJunqueira in post #12, it is really a bad practice to use empty columns and rows to divide a table.

  15. #15
    Registered User
    Join Date
    12-17-2023
    Location
    Indianapolis, IN
    MS-Off Ver
    Office Professional Plus 2021
    Posts
    18

    Re: Need Help with IF Function,And Function & Mod Function

    You don't need the MOD function here. You just need to put this formula into these cells.

    G7 ----> =IF($C$1 <1000,"Nil",IF($C$1 < 100000,$C$1*E7,"Nil"))
    G9 ----> =IF($C$1 <100000,"Nil",IF($C$1 < 250000,$C$1*E9,"Nil"))
    G11 ---> =IF($C$1 <250000,"Nil",IF($C$1 < 1000000,$C$1*E11,"Nil"))
    G13 ---> =IF($C$1 <1000000,"Nil",IF($C$1 < 3000000,$C$1*E13,"Nil"))
    G15 ---> =IF($C$1 <3000000,"Nil",$C$1*E15)

    The last cell (G15) does not need to check for an upper limit. If you want to be more flexible, instead of hard coding the $ range values, put them in actual cells and point to them in the formulas instead of the actual values.
    Last edited by cwayneu; 12-20-2023 at 12:37 PM.

  16. #16
    Registered User
    Join Date
    12-17-2023
    Location
    Indianapolis, IN
    MS-Off Ver
    Office Professional Plus 2021
    Posts
    18

    Re: Need Help with IF Function,And Function & Mod Function

    Replying to my own post, but this would be my solution attached.

  17. #17
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    Sorry for being late, thanks for more clarification, I will send you my final Excel sheet that shows what I mean, please have a look, especially Cell B1.

    Cell B1, I used as the primary cell for any inputted amount, the equation used you will find the following path:-
    click on " Data Tab", then from data tools click on " Data Validation ", then "Settings" then "Formula".


    the challenges that I face right now are as follows "-

    trying to input one of the following amounts: ( 250000, 270000, 290000, 310000, 330000, 350000, 370000, 390000, 410000 ), the error message is shown, however, these amounts met the other condition.


    I think the 3rd segment which is ( 250000 and multiplier 10000 )is the only one that doesn't agree with others.



    Notes:

    the main problem right now is how to adjust ( 250000, multiplier 10000).

    take care, we have three different multipliers as follows : ( 1000, 10000, 100000 ).


    if you have another idea for that, you are welcome.

    thanks in advance,,,


    Update_002_Sales Discount Amount_More Than Multiplier.xlsx

  18. #18
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    thanks for your help, but I prefer to use the Excel sheet as shown in post #17 for organizational purposes.

  19. #19
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    thanks for your help, please have a look at post #17, and you will get the idea and hope to find a solution for that.

  20. #20
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    The last Update for my question is as follows:-

    Please have A look at Thread/post # 17


    Thanks for any ideas or suggestions, I hope to find a solution.

    Thanks in Advance,,,

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Need Help with IF Function,And Function & Mod Function

    Making the text in your message larger won't make things happen any faster.

    Please bear in mind that many of our members are now into Christmas weekend, so things will slow down here.

    Also you have bumped this thread FOUR times in the space of 15 minutes - you may bump a thread once a day only.

    Administrative Note:

    Please do not bump threads until 24 hours have passed, and then only once each day. We are all volunteers here who have lives beyond this forum. While you may be awake and working, this is a world wide forum and others may be playing, sleeping or working and not have the time to look into your issues this minute. Patience is important here. If you have an urgent issue, you may wish to look at paying for help in the Commercial Services sub-forum or hiring a professional consultant in your area. Again, please do not bump threads more often than once in every 24 hours: if you get the help you need today, then great, but you really should not count on it. Thanks for your understanding and patience.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  22. #22
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    I'm very Sorry for the unintended mistake, I just want to highlight the last thing to my question.

    I repeated my deep apologies and I am sorry for any inconvenience or disturbance.

    Thanks for helping me.

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Need Help with IF Function,And Function & Mod Function

    No worries - just bear this in mind. Thanks.

  24. #24
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    No error with the attached on the data in post #17

  25. #25
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    Thank You So Much, You are Excellent !!! , You did it.

    I have a question, please let me know, how do you get it?

    in the following equation:-

    =IF(AND(C1<100000,MOD(C1,1000)=0),C1,IF(AND(C1<250000,MOD(C1,10000)=0),C1,IF(AND(C1<1000000,MOD(C1,10000)=0),C1,IF(AND(C1<3000000,MOD(C1,100000)=0),C1,IF(MOD(C1,10000)=0,C1,"Invalid Amount")))))


    the bold part in the equation, especially ( 1000000 ), you use the multiplier 10000, NOT 100000, however, you have to use it rather than 10000, according to the sales segment.


    you change the use of ( multiplier ) and are not restricted to the rules of the discount rate, however, the equation has been met.

    Waiting your reply, thank you so much again,,,

  26. #26
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    You cannot have both a formula and value in the same cell so if to want to enter the value in B1, where do you want the formula?

    So change the formula to reference the cell with value i.e B1 bot C1: not too difficult!

    Nor is correcting my typo!
    Last edited by JohnTopley; 12-23-2023 at 03:57 PM.

  27. #27
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    I mean by that:- if you go back to thread #17, please have a look at to Excel sheet, and compare it with the Excel sheet you mentioned in thread #24, you will see the difference.

    the main difference is that: you change ( multiplier 10000) and replace it with another one and I didn't know why you do that.

  28. #28
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    You should be able to correct any (of mine) errors in the multipliers. I adjusted the 250,000 multiplier as you required.

    and you say this

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    should be

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    so amend the formula

  29. #29
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    Sorry for being late to reply and Thanks again for helping me.

    I don't understand your answer, I understand that you replaced the multiplier 10000 with 100000.

    could you please use the following multipliers:-
    250000, multiplier 10000
    1000000, multiplier 100000 NOT 10000?



    Does it make a difference if we use the multiplier 10000 with 1000000 ?

    I mean by that, is it correct to say:- ( 1000000, multiplier 10000) = ( 1000000, multiplier 10000) ?


    Thanks in advance,,,

  30. #30
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Need Help with IF Function,And Function & Mod Function

    Just change the MULTIPLIER value to those you want.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  31. #31
    Registered User
    Join Date
    12-16-2023
    Location
    Egypt
    MS-Off Ver
    Professional Plus 2019
    Posts
    24

    Re: Need Help with IF Function,And Function & Mod Function

    First of all, Happy New Year, and hope all of you are well, thanks for your efforts to help me.

    I have been trying your solution more than ten times to find what I'm asking for it, unfortunately, no answer find answer what I'm looking for.

    all I need just the solution to my question as mentioned in Thread #25.


    Notes:-
    we still have the same problem, I changed the multiplier but the equation hasn't been met, please go back to thread to thread #25.


    Sorry for any inconvenience & disturbance, and thanks in advance,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 02-10-2023, 10:18 AM
  2. [SOLVED] Left function, Right Function, or Mid Function to extract values to three decimal places
    By bjnockle in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-08-2023, 03:22 AM
  3. Right function, Left function, Mid function to extract values in column A
    By bjnockle in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 06-14-2020, 03:14 PM
  4. COUNTUNIQUE Function in Google Sheets; Excel lacks a direct counterpart to this function?
    By PivotTablePSHomage in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2018, 05:27 AM
  5. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  6. Replies: 13
    Last Post: 04-08-2014, 05:46 AM
  7. Replies: 1
    Last Post: 03-21-2012, 11:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1