View Full Version : Solved: how to find the value with 2 conditions
hardlife
06-17-2009, 02:36 AM
dear everybody,
now me is solving problem how to find the value with 2 conditions?
no idea for now, if somebody knows the way forward,
please help me, happy and sunny day, Pavel
Weight upto (1st condition)
Distance upto (2nd condition)
Price = ?
example file appended
p45cal
06-17-2009, 04:16 AM
It would help to rearrange the table, see attached
hardlife
06-17-2009, 04:55 AM
Dear p45cal, my table was originally arranged this way.
THANK You a lot, You are genius :bow: me was not able
to solve it.
p45cal me is wishing you good luck and sunny day,
Pavel Humenuk
originally me used this link:
http://www.ozgrid.com/forum/showthread.php?t=45511
to rearrange it.
Sub CreateFlat()
Dim wsData As Worksheet
Dim wsNew As Worksheet
Dim rngSrc As Range
Dim rngDst As Range
Dim LastCol As Long
Dim LastRow As Long
Dim LastRowDst As Long
Dim I As Long
Set wsData = Worksheets("Sheet1")
Set wsNew = Worksheets.Add
LastRow = wsData.Range("A" & Rows.Count).End(xlUp).Row
LastRowDst = 2
LastCol = wsData.Range("IV1").End(xlToLeft).Column
wsNew.Range("A1:C1") = Array("Resources", "Month", "Value")
For I = 2 To LastRow
Set rngSrc = wsData.Range("A" & I)
Set rngDst = wsNew.Range("A" & LastRowDst)
rngSrc.Copy rngDst.Resize(LastCol - 1)
rngSrc.Offset(-(I - 1), 1).Resize(, LastCol - 1).Copy
rngDst.Offset(0, 1).PasteSpecial Transpose:=True
rngSrc.Offset(, 1).Resize(, LastCol - 1).Copy
rngDst.Offset(0, 2).PasteSpecial Transpose:=True
LastRowDst = LastRowDst + (LastCol - 1)
Next I
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.