Results 1 to 17 of 17

Thread: [RESOLVED] Excel Differences

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Resolved [RESOLVED] Excel Differences

    Hello

    I'm struggling to write an excel macro or formula to work out differences in columns and would really appreciate if some kind person could help me out:-

    See spreadsheet attached.

    I need to do the following calculation.

    Work out the figure for Column H minus Column E then if this figure is less than Column A i need to highlight the row in Yellow.

    Is this possible?
    Attached Files Attached Files
    Gilly

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Excel Differences

    Moved From FAQ Section

  3. #3
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Excel Differences

    No need to use macros, use conditional formating with formula:
    =($H4-$E4)<$B4
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    Thanks very much.
    How do i ignore the rows which are blank? Currently when i copy down your forumla i get the word "TRUE" in all the empty rows.

    Also, is there any way to colour the row in yellow if the result is TRUE?

    thanks so much
    Gilly

  5. #5
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Excel Differences

    No way to use cell formulas to change the color.
    As I said, use Conditional Formating
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    Thanks, reading about conditional formatting now. Is it possible to ignore the rows that have blanks in the Stock column & the Items in Stage column?
    Gilly

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    i have tried adding to your formula below. But my syntax is wrong - can you help me fix it?

    =AND($H4-$E4)NOT(ISBLANK)<$B4

    I'm trying to ignore the rows which have blank cells in columns H or E
    Gilly

  8. #8
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Excel Differences

    =and($h4>0, $e4>0, $h4-$e4<$b4)
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    Thanks Anhn, unfortunately i tried your formula however it returns FALSE in the rows that have blanks....i need it to output no word (True or False) in those rows with blanks.

    Sorry to be a pain. I really appreciate your time.
    Gilly

  10. #10
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Differences

    Quote Originally Posted by gilly
    Thanks Anhn, unfortunately i tried your formula however it returns FALSE in the rows that have blanks....i need it to output no word (True or False) in those rows with blanks.

    Sorry to be a pain. I really appreciate your time.
    Follow these steps. i am using your workbook as a reference...

    Click on cell E4
    Click on tools format=>Conditional formating
    Select "Formula is" in Condition 1
    type

    =AND($H4-$E4<$B4,LEN($E4)>0)

    in the textbox next to it. after that click on the format button. Under the patterns tab, select Yellow. and click ok.

    Now click the format painter button from the tools, and paint the rest of the cells down. The cells will automatically be conditionally formated.

    Hope this helps...

    If I misunderstood your query, then do explain it to me again and I will try and help...

    Edit: I am attaching a copy of your workbook where the cells are conditionaly formated...
    Attached Files Attached Files
    Last edited by Siddharth Rout; Jun 20th, 2008 at 05:51 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    Thanks for your time. However the cells which are blank in columns H and Column E should output nothing i.e leave the cell White.

    Instead the conditional formula outputs the word FALSE if the cell is blank.

    How do i get it to output nothing?? i.e. leave the cell White / Empty
    Gilly

  12. #12
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Excel Differences

    Quote Originally Posted by gilly
    Thanks for your time. However the cells which are blank in columns H and Column E should output nothing i.e leave the cell White.

    Instead the conditional formula outputs the word FALSE if the cell is blank.

    How do i get it to output nothing?? i.e. leave the cell White / Empty
    What? Conditional formula must return either TRUE or FALSE. If TRUE then set background to Yellow, otherwise leave it as default.
    You won't see any value TRUE/FALSE from Conditional formula.
    Attached Files Attached Files
    Last edited by anhn; Jun 20th, 2008 at 09:04 AM.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    Sorry. I understand now. . I was copying the cells instead of filling the cells with the formula.

    thanks for all your help
    Gilly

  14. #14
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Differences

    Quote Originally Posted by gilly
    I was copying the cells instead of filling the cells with the formula.

    thanks for all your help
    If you would have gone through what I mentioned above, you would have seen that you could have used the format painter to do the job. you don't need to put the formula manually
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  15. #15
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Excel Differences

    No need to know how to use format painter.
    Highlight Data range A4:H25 starting from A4, enter Conditional Formula just once as:
    =AND($H4>0, $E4>0, $H4-$E4<$B4)
    for cell A4. All other cells will have Conditional Formulas updated with their row numbers automatically.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  16. #16
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Differences

    Quote Originally Posted by anhn
    No need to know how to use format painter.
    Highlight Data range A4:H25 starting from A4, enter Conditional Formula just once as:
    =AND($H4>0, $E4>0, $H4-$E4<$B4)
    for cell A4. All other cells will have Conditional Formulas updated with their row numbers automatically.
    Yup that's another way to do it...

    The third way to do it would be to copy cell A4 after the conditional formating is done AND then do a "pastespecial-Formats" on the rest of the cells.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Re: Excel Differences

    Work brilliantly, thanks to you both.

    xxxxxxxx
    Gilly

Posting Permissions

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



Click Here to Expand Forum to Full Width